ServiceExt

Trait ServiceExt 

Source
pub trait ServiceExt<R: ServiceRole>: Service<R> + Sized {
    // Required method
    fn serve_with_ct<T, E, A>(
        self,
        transport: T,
        ct: CancellationToken,
    ) -> impl Future<Output = Result<RunningService<R, Self>, R::InitializeError>> + Send
       where T: IntoTransport<R, E, A>,
             E: Error + Send + Sync + 'static,
             Self: Sized;

    // Provided methods
    fn into_dyn(self) -> Box<dyn DynService<R>> { ... }
    fn serve<T, E, A>(
        self,
        transport: T,
    ) -> impl Future<Output = Result<RunningService<R, Self>, R::InitializeError>> + Send
       where T: IntoTransport<R, E, A>,
             E: Error + Send + Sync + 'static,
             Self: Sized { ... }
}
Available on crate features client or server only.

Required Methods§

Source

fn serve_with_ct<T, E, A>( self, transport: T, ct: CancellationToken, ) -> impl Future<Output = Result<RunningService<R, Self>, R::InitializeError>> + Send
where T: IntoTransport<R, E, A>, E: Error + Send + Sync + 'static, Self: Sized,

Provided Methods§

Source

fn into_dyn(self) -> Box<dyn DynService<R>>

Convert this service to a dynamic boxed service

This could be very helpful when you want to store the services in a collection

Source

fn serve<T, E, A>( self, transport: T, ) -> impl Future<Output = Result<RunningService<R, Self>, R::InitializeError>> + Send
where T: IntoTransport<R, E, A>, E: Error + Send + Sync + 'static, Self: Sized,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<S: Service<RoleClient>> ServiceExt<RoleClient> for S

Available on crate feature client only.
Source§

impl<S: Service<RoleServer>> ServiceExt<RoleServer> for S

Available on crate feature server only.