Skip to content

Commit

Permalink
extract the complex type
Browse files Browse the repository at this point in the history
  • Loading branch information
Rain Jiang authored and ihciah committed Nov 10, 2023
1 parent a67d107 commit 98fcb51
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions service-async/src/boxed.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,15 +80,17 @@ where
}
}

type BoxedFuture<T, E> = Pin<Box<dyn Future<Output = Result<T, E>>>>;

struct ServiceVtable<T, U, E> {
call: unsafe fn(raw: *const (), req: T) -> Pin<Box<dyn Future<Output = Result<U, E>>>>,
call: unsafe fn(raw: *const (), req: T) -> BoxedFuture<U,E>,
drop: unsafe fn(raw: *const ()),
}

unsafe fn call<R, S>(
svc: *const (),
req: R,
) -> Pin<Box<dyn Future<Output = Result<S::Response, S::Error>>>>
) -> BoxedFuture<S::Response, S::Error>
where
R: 'static,
S: Service<R> + 'static,
Expand Down

0 comments on commit 98fcb51

Please sign in to comment.