Skip to content

Commit 1aad586

Browse files
committed
Use AsyncFnOnce
1 parent c3763bd commit 1aad586

File tree

1 file changed

+6
-8
lines changed

1 file changed

+6
-8
lines changed

ui/src/server_axum.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ use orchestrator::coordinator::{self, CoordinatorFactory, DockerBackend, TRACKED
2929
use snafu::prelude::*;
3030
use std::{
3131
convert::TryInto,
32-
future::Future,
3332
mem, path,
3433
str::FromStr,
3534
sync::{Arc, LazyLock},
@@ -207,16 +206,15 @@ async fn rewrite_help_as_index(
207206
next.run(req).await
208207
}
209208

210-
async fn attempt_record_request<T, RFut, RT, RE>(
209+
async fn attempt_record_request<R, T, E>(
211210
db: Handle,
212-
req: T,
213-
f: impl FnOnce(T) -> RFut,
214-
) -> Result<RT, RE>
211+
req: R,
212+
f: impl AsyncFnOnce(R) -> Result<T, E>,
213+
) -> Result<T, E>
215214
where
216-
T: HasEndpoint + serde::Serialize,
217-
RFut: Future<Output = Result<RT, RE>>,
215+
R: HasEndpoint + serde::Serialize,
218216
{
219-
let category = format!("http.{}", <&str>::from(T::ENDPOINT));
217+
let category = format!("http.{}", <&str>::from(R::ENDPOINT));
220218
let payload = serde_json::to_string(&req).unwrap_or_else(|_| String::from("<invalid JSON>"));
221219
let guard = db.start_with_guard(category, payload).await;
222220

0 commit comments

Comments
 (0)