Trait Service

Source
pub trait Service<ServerStream: Stream<Item = Event>> {
    type AppStream: Stream<Item = Event>;
    type Error: Error;
    type Future: Future<Output = Result<Self::AppStream, Self::Error>>;

    // Required method
    fn call(
        &mut self,
        scope: Scope,
        server_events: ServerStream,
    ) -> Self::Future;
}
Expand description

Trait, representing a Service, that is used to handle connections.

It can handle multiple connections at simultaneously.

ASGI equivalent: Application

Required Associated Types§

Source

type AppStream: Stream<Item = Event>

Source

type Error: Error

Source

type Future: Future<Output = Result<Self::AppStream, Self::Error>>

Required Methods§

Source

fn call(&mut self, scope: Scope, server_events: ServerStream) -> Self::Future

Main function of a service.

Implementors§

Source§

impl<X, S, SS> Service<SS> for X
where X: DerefMut<Target = S>, S: Service<SS>, SS: Stream<Item = Event>,

Source§

type AppStream = <S as Service<SS>>::AppStream

Source§

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

Source§

type Future = <S as Service<SS>>::Future