Skip to main content

BlockingService

Trait BlockingService 

pub trait BlockingService<Input>:
    Sized
    + Send
    + Sync
    + 'static {
    type Output: Send + 'static;
    type Error: Send + 'static;

    // Required method
    fn serve(&self, input: Input) -> Result<Self::Output, Self::Error>;
}
Expand description

A synchronous Service boundary.

Rama stacks remain asynchronous internally. Implementations of this trait expose a blocking outer boundary to callers that cannot or do not want to run an async runtime themselves.

Required Associated Types§

type Output: Send + 'static

The type of output returned by the service.

type Error: Send + 'static

The type of error returned by the service.

Required Methods§

fn serve(&self, input: Input) -> Result<Self::Output, Self::Error>

Serve input, blocking the calling thread until the result is ready.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

§

impl<S, Input> BlockingService<Input> for &'static S
where S: BlockingService<Input>,

§

type Output = <S as BlockingService<Input>>::Output

§

type Error = <S as BlockingService<Input>>::Error

§

fn serve( &self, input: Input, ) -> Result<<&'static S as BlockingService<Input>>::Output, <&'static S as BlockingService<Input>>::Error>

Implementors§

§

impl<S, B> BlockingService<Request> for Client<S>
where S: Service<Request, Output = Response<B>>, <S as Service<Request>>::Error: Into<Box<dyn Error + Send + Sync>>, B: Body<Data = Bytes> + Send + 'static, <B as Body>::Error: Into<Box<dyn Error + Send + Sync>>,

§

type Output = Response

§

type Error = Box<dyn Error + Send + Sync>

§

impl<S, Input> BlockingService<Input> for Arc<S>
where S: BlockingService<Input>,

§

type Output = <S as BlockingService<Input>>::Output

§

type Error = <S as BlockingService<Input>>::Error

§

impl<S, Input> BlockingService<Input> for Box<S>
where S: BlockingService<Input>,

§

type Output = <S as BlockingService<Input>>::Output

§

type Error = <S as BlockingService<Input>>::Error

§

impl<S, Input> BlockingService<Input> for Service<S>
where S: Service<Input> + Clone, Input: Send + 'static,

§

type Output = Guarded<<S as Service<Input>>::Output>

§

type Error = <S as Service<Input>>::Error