Trait SendService

Source
pub trait SendService<Request>: Sealed<Request> {
    type Service: Service<Request, Response = Response<Self::Body>, Error = Self::Error, Future = Self::Future> + Send + 'static;
    type Body: Body<Data = Self::BodyData, Error = Self::BodyError> + Send + 'static;
    type BodyData: Send + 'static;
    type BodyError: Into<Box<dyn Error + Send + Sync>>;
    type Error: Into<Box<dyn Error + Send + Sync>>;
    type Future: Future<Output = Result<Response<Self::Body>, Self::Error>> + Send + 'static;

    // Required method
    fn into_service(self) -> Self::Service;
}
Expand description

An alias trait for the Service trait, specialized with required bounds for the server’s service function. This trait has been sealed, ensuring it cannot be implemented by types outside of this crate.

It provides constraints for the body data, errors, and asynchronous behavior that fits the server’s needs.

Required Associated Types§

Source

type Service: Service<Request, Response = Response<Self::Body>, Error = Self::Error, Future = Self::Future> + Send + 'static

Source

type Body: Body<Data = Self::BodyData, Error = Self::BodyError> + Send + 'static

Source

type BodyData: Send + 'static

Source

type BodyError: Into<Box<dyn Error + Send + Sync>>

Source

type Error: Into<Box<dyn Error + Send + Sync>>

Source

type Future: Future<Output = Result<Response<Self::Body>, Self::Error>> + Send + 'static

Required Methods§

Source

fn into_service(self) -> Self::Service

Convert this type into a service.

Implementors§

Source§

impl<T, B, Request> SendService<Request> for T
where T: Service<Request, Response = Response<B>> + Send + 'static, T::Error: Into<Box<dyn Error + Send + Sync>>, T::Future: Send + 'static, B: Body + Send + 'static, B::Data: Send + 'static, B::Error: Into<Box<dyn Error + Send + Sync>>,

Source§

type Service = T

Source§

type Body = B

Source§

type BodyData = <B as Body>::Data

Source§

type BodyError = <B as Body>::Error

Source§

type Error = <T as Service<Request>>::Error

Source§

type Future = <T as Service<Request>>::Future