Struct FutureService
struct FutureService<F, S> { ... }
A type that implements Service for a Future that produces a Service.
See future_service for more details.
Implementations
impl<F, S> FutureService<F, S>
const fn new(future: F) -> SelfReturns a new
FutureServicefor the given future.A
FutureServiceallows you to treat a future that resolves to a service as a service. This can be useful for services that are created asynchronously.Example
use ; use FutureService; use Infallible; #Regarding the
UnpinboundThe
Unpinbound onFis necessary because the future will be polled inService::poll_readywhich doesn't have a pinned receiver (it takes&mut selfand notself: Pin<&mut Self>). So we cannot put the future into aPinwithout requiringUnpin.This will most likely come up if you're calling
future_servicewith an async block. In that case you can useBox::pin(async { ... })as shown in the example.
impl<F, S> Debug for FutureService<F, S>
fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result
impl<F, S> Freeze for FutureService<F, S>
impl<F, S> RefUnwindSafe for FutureService<F, S>
impl<F, S> Send for FutureService<F, S>
impl<F, S> Sync for FutureService<F, S>
impl<F, S> Unpin for FutureService<F, S>
impl<F, S> UnsafeUnpin for FutureService<F, S>
impl<F, S> UnwindSafe for FutureService<F, S>
impl<F, S, R, E> Service for FutureService<F, S>
fn poll_ready(self: &mut Self, cx: &mut Context<'_>) -> Poll<Result<(), <Self as >::Error>>fn call(self: &mut Self, req: R) -> <Self as >::Future
impl<F: $crate::clone::Clone, S: $crate::clone::Clone> Clone for FutureService<F, S>
fn clone(self: &Self) -> FutureService<F, S>
impl<M, S, Target, Request> MakeService for FutureService<F, S>
fn poll_ready(self: &mut Self, cx: &mut Context<'_>) -> Poll<Result<(), <M as MakeService<Target, Request>>::MakeError>>fn make_service(self: &mut Self, target: Target) -> <M as MakeService<Target, Request>>::Future
impl<T> Any for FutureService<F, S>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for FutureService<F, S>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for FutureService<F, S>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for FutureService<F, S>
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for FutureService<F, S>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Instrument for FutureService<F, S>
impl<T> ToOwned for FutureService<F, S>
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T> WithSubscriber for FutureService<F, S>
impl<T, Request> ServiceExt for FutureService<F, S>
impl<T, U> Into for FutureService<F, S>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for FutureService<F, S>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for FutureService<F, S>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>