pub struct EngineIoService<H: EngineIoHandler, S = NotFoundService> { /* private fields */ }
Expand description

A [Service] that handles EngineIo requests as a middleware. If the request is not an EngineIo request, it forwards it to the inner service. It is agnostic to the TransportType.

By default, it uses a NotFoundService as the inner service so it can be used as a standalone [Service].

Implementations§

source§

impl<H: EngineIoHandler> EngineIoService<H, NotFoundService>

source

pub fn new(handler: H) -> Self

Create a new EngineIoService with a NotFoundService as the inner service. If the request is not an EngineIo request, it will always return a 404 response.

source

pub fn with_config(handler: H, config: EngineIoConfig) -> Self

Create a new EngineIoService with a custom config

source§

impl<S: Clone, H: EngineIoHandler> EngineIoService<H, S>

source

pub fn with_inner(inner: S, handler: H) -> Self

Create a new EngineIoService with a custom inner service.

source

pub fn with_config_inner(inner: S, handler: H, config: EngineIoConfig) -> Self

Create a new EngineIoService with a custom inner service and a custom config.

source

pub fn into_make_service(self) -> MakeEngineIoService<H, S>

Convert this EngineIoService into a MakeEngineIoService. This is useful when using EngineIoService without layers.

Trait Implementations§

source§

impl<S: Clone, H: EngineIoHandler> Clone for EngineIoService<H, S>

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl<H: EngineIoHandler, S> Debug for EngineIoService<H, S>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<ReqBody, ResBody, S, H> Service<Request<ReqBody>> for EngineIoService<H, S>
where ResBody: Body + Send + 'static, ReqBody: Body + Send + Unpin + 'static + Debug, <ReqBody as Body>::Error: Debug, <ReqBody as Body>::Data: Send, S: Service<Request<ReqBody>, Response = Response<ResBody>>, H: EngineIoHandler,

The service implementation for EngineIoService.

source§

fn call(&mut self, req: Request<ReqBody>) -> Self::Future

Handle the request. Each request is parsed to extract the TransportType and the socket id. If the request is an EngineIo request, it is handled by the EngineIo engine. Otherwise, it is forwarded to the inner service.

§

type Response = Response<ResponseBody<ResBody>>

Responses given by the service.
§

type Error = <S as Service<Request<ReqBody>>>::Error

Errors produced by the service.
§

type Future = ResponseFuture<<S as Service<Request<ReqBody>>>::Future, ResBody>

The future response value.
source§

fn poll_ready(&mut self, cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>>

Returns Poll::Ready(Ok(())) when the service is able to process requests. Read more

Auto Trait Implementations§

§

impl<H, S> RefUnwindSafe for EngineIoService<H, S>

§

impl<H, S> Send for EngineIoService<H, S>
where S: Send,

§

impl<H, S> Sync for EngineIoService<H, S>
where S: Sync,

§

impl<H, S> Unpin for EngineIoService<H, S>
where S: Unpin,

§

impl<H, S> UnwindSafe for EngineIoService<H, S>

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more