Skip to main content

Io

Struct Io 

Source
pub struct Io<F = Base>(/* private fields */);
Expand description

Interface object to the underlying I/O stream

Implementations§

Source§

impl Io

Source

pub fn new<I, T>(io: I, cfg: T) -> Io
where I: IoStream, T: Into<SharedCfg>,

Creates a new Io instance.

Source§

impl<F> Io<F>

Source

pub fn get_ref(&self) -> IoRef

Get an instance of IoRef.

Source

pub fn take(&self) -> Io<F>

Takes the current I/O object.

After this call, the I/O object is no longer valid for use.

Source

pub fn set_config<T>(&self, cfg: T)
where T: Into<SharedCfg>,

Updates the shared I/O configuration.

Source§

impl<F, T> Io<Layer<F, T>>
where F: FilterLayer, T: Filter,

Source

pub fn filter(&self) -> &F

Returns a reference to a filter.

Source§

impl<F> Io<F>
where F: Filter,

Source

pub fn seal(self) -> Io<Sealed>

Convert the current I/O stream into a sealed version.

Source

pub fn boxed(self) -> IoBoxed

Convert the current I/O stream into a boxed version.

Source

pub fn add_filter<U>(self, nf: U) -> Io<Layer<U, F>>
where U: FilterLayer,

Adds a new processing layer to the current filter chain.

Source

pub fn map_filter<U, R>(self, f: U) -> Io<R>
where U: FnOnce(F) -> R, R: Filter,

Wraps the current layer with a wrapper.

Source§

impl<F> Io<F>

Source

pub async fn recv<U>( &self, codec: &U, ) -> Result<Option<<U as Decoder>::Item>, Either<<U as Decoder>::Error, Error>>
where U: Decoder,

Reads from the incoming I/O stream and decodes a codec item.

Source

pub async fn read(&self, dst: &mut [u8]) -> Result<(), Error>

Reads bytes from this I/O stream into the specified buffer.

If there is not enough data available, waits for incoming data. Returns an error of kind io::ErrorKind::UnexpectedEof if the stream is disconnected before dst is completely filled.

Source

pub async fn read_ready(&self) -> Result<Option<()>, Error>

Waits until the I/O stream is ready for reading.

Source

pub async fn read_notify(&self) -> Result<Option<()>, Error>

Waits until the I/O stream receives new data.

Source

pub fn pause(&self)

Pauses the read task.

Source

pub async fn send<U>( &self, item: <U as Encoder>::Item, codec: &U, ) -> Result<(), Either<<U as Encoder>::Error, Error>>
where U: Encoder,

Encodes an item and sends it to the peer, fully flushing the write buffer.

Source

pub async fn flush(&self, full: bool) -> Result<(), Error>

Wakes the write task and requests a flush of buffered data.

This is the async version of .poll_flush() method.

Source

pub async fn shutdown(&self) -> Result<(), Error>

Gracefully shuts down the I/O stream.

Source

pub fn poll_read_ready( &self, cx: &mut Context<'_>, ) -> Poll<Result<Option<()>, Error>>

Polls for read readiness.

If the I/O stream is not currently ready for reading, this method will store a clone of the Waker from the provided Context. When the I/O stream becomes ready for reading, wake() will be called on the waker.

§Returns

The function returns:

  • Poll::Pending if the I/O stream is not ready for reading.
  • Poll::Ready(Ok(Some(()))) if the I/O stream is ready for reading.
  • Poll::Ready(Ok(None)) if the I/O stream is disconnected.
  • Poll::Ready(Err(e)) if an error is encountered.
Source

pub fn poll_read_notify( &self, cx: &mut Context<'_>, ) -> Poll<Result<Option<()>, Error>>

Polls the I/O stream for availability of incoming data.

Source

pub fn poll_recv<U>( &self, codec: &U, cx: &mut Context<'_>, ) -> Poll<Result<<U as Decoder>::Item, RecvError<U>>>
where U: Decoder,

Decode codec item from incoming bytes stream.

Wake read task and request to read more data if data is not enough for decoding. If error get returned this method does not register waker for later wake up action.

Source

pub fn poll_recv_decode<U>( &self, codec: &U, cx: &mut Context<'_>, ) -> Result<Decoded<<U as Decoder>::Item>, RecvError<U>>
where U: Decoder,

Decode codec item from incoming bytes stream.

Wake read task and request to read more data if data is not enough for decoding. If error get returned this method does not register waker for later wake up action.

Source

pub fn poll_flush( &self, cx: &mut Context<'_>, full: bool, ) -> Poll<Result<(), Error>>

Wakes the write task and instructs it to flush data.

If full is true, wakes the dispatcher when all data has been flushed; otherwise, it wakes when the write buffer size falls below the low-watermark size.

Source

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

Gracefully shuts down the I/O stream.

Source

pub fn poll_read_pause(&self, cx: &mut Context<'_>) -> Poll<IoStatusUpdate>

Pauses the read task.

Returns status updates.

Source

pub fn poll_status_update(&self, cx: &mut Context<'_>) -> Poll<IoStatusUpdate>

Polls for available status updates.

Source

pub fn poll_dispatch(&self, cx: &mut Context<'_>)

Registers a dispatch task.

Methods from Deref<Target = IoRef>§

Source

pub fn id(&self) -> Id

Gets the ID.

Source

pub fn tag(&self) -> &'static str

Gets the I/O tag.

Source

pub fn cfg(&self) -> &IoConfig

Gets the configuration.

Source

pub fn shared(&self) -> SharedCfg

Gets the shared configuration.

Source

pub fn is_closed(&self) -> bool

Checks whether the I/O stream is closed.

Source

pub fn is_wr_backpressure(&self) -> bool

Checks whether write back-pressure is enabled.

Source

pub fn close(&self)

Gracefully closes the connection.

Initiates the I/O stream shutdown process.

Source

pub fn terminate(&self)

Force-closes the connection.

The dispatcher does not wait for incomplete responses. The I/O stream is terminated without any graceful period.

Source

pub fn query<T>(&self) -> QueryItem<T>
where T: 'static,

Queries filter-specific data.

Source

pub fn encode<U>( &self, item: <U as Encoder>::Item, codec: &U, ) -> Result<(), <U as Encoder>::Error>
where U: Encoder,

Encodes the item into the write buffer.

Source

pub fn encode_slice(&self, src: &[u8]) -> Result<(), Error>

Encodes the slice into the write buffer.

Source

pub fn encode_bytes<B>(&self, src: B) -> Result<(), Error>
where BytePage: From<B>,

Writes bytes to the write buffer.

Source

pub fn decode<U>( &self, codec: &U, ) -> Result<Option<<U as Decoder>::Item>, <U as Decoder>::Error>
where U: Decoder,

Attempts to decode a frame from the read buffer.

Source

pub fn decode_item<U>( &self, codec: &U, ) -> Result<Decoded<<U as Decoder>::Item>, <U as Decoder>::Error>
where U: Decoder,

Attempts to decode a frame from the read buffer.

Source

pub fn send_buf(&self) -> Result<(), Error>

Sends the write buffer to the I/O layer.

Requires the underlying runtime to implement .write(); otherwise, no action is taken.

Source

pub fn with_buf<F, R>(&self, f: F) -> Result<R, Error>
where F: FnOnce(&mut FilterBuf<'_>) -> R,

Get access to filter buffer

Source

pub fn with_read_buf<F, R>(&self, f: F) -> R
where F: FnOnce(&mut BytesMut) -> R,

Get mut access to read buffer

Source

pub fn with_write_buf<F, R>(&self, f: F) -> Result<R, Error>
where F: FnOnce(&mut BytePages) -> R,

Get mut access to source write buffer

Source

pub fn with_read_src_buf<F, R>(&self, f: F) -> R
where F: FnOnce(&mut BytesMut) -> R,

Get mut access to src read buffer

Source

pub fn with_write_dst_buf<F, R>(&self, f: F) -> R
where F: FnOnce(&mut BytePages) -> R,

Get mut access to dest write buffer

Source

pub fn resize_read_buf(&self, buf: &mut BytesMut)

Make sure buffer has enough free space

Source

pub fn notify_dispatcher(&self)

Wakeup dispatcher

Source

pub fn notify_timeout(&self)

Wakeup dispatcher and send keep-alive error

Source

pub fn timer_handle(&self) -> TimerHandle

Current timer handle

Source

pub fn start_timer(&self, timeout: Seconds) -> TimerHandle

Start timer

Source

pub fn stop_timer(&self)

Stop timer

Source

pub fn on_disconnect(&self) -> OnDisconnect

Notify when io stream get disconnected

Trait Implementations§

Source§

impl<F> AsRef<IoRef> for Io<F>

Source§

fn as_ref(&self) -> &IoRef

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<F> Debug for Io<F>

Source§

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

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

impl<F> Deref for Io<F>

Source§

type Target = IoRef

The resulting type after dereferencing.
Source§

fn deref(&self) -> &<Io<F> as Deref>::Target

Dereferences the value.
Source§

impl<F> Drop for Io<F>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl<F> Eq for Io<F>

Source§

impl<I> From<I> for Io
where I: IoStream,

Source§

fn from(io: I) -> Io

Converts to this type from the input type.
Source§

impl<F> From<Io<F>> for IoBoxed
where F: Filter,

Source§

fn from(io: Io<F>) -> IoBoxed

Converts to this type from the input type.
Source§

impl<F> From<Io<F>> for TokioIoBoxed
where F: Filter,

Source§

fn from(io: Io<F>) -> TokioIoBoxed

Converts to this type from the input type.
Source§

impl From<IoBoxed> for Io<Sealed>

Source§

fn from(value: IoBoxed) -> Io<Sealed>

Converts to this type from the input type.
Source§

impl<F> Hash for Io<F>

Source§

fn hash<H>(&self, state: &mut H)
where H: Hasher,

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl<F> PartialEq for Io<F>

Source§

fn eq(&self, other: &Io<F>) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<F, Pub, Ctl> Service<Io<F>> for ServerHandler<Pub, Ctl>

Source§

type Response = ()

Responses given by the service.
Source§

type Error = ServerError<()>

Errors produced by the service when polling readiness or executing call.
Source§

async fn call( &self, req: Io<F>, _: ServiceCtx<'_, ServerHandler<Pub, Ctl>>, ) -> Result<<ServerHandler<Pub, Ctl> as Service<Io<F>>>::Response, <ServerHandler<Pub, Ctl> as Service<Io<F>>>::Error>

Processes a request and returns the response asynchronously. Read more
Source§

async fn ready(&self, ctx: ServiceCtx<'_, Self>) -> Result<(), Self::Error>

Returns when the service is ready to process requests. Read more
Source§

async fn shutdown(&self)

Shuts down the service. Read more
Source§

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

Polls the service from the current async task. Read more
Source§

fn map<F, Res>(self, f: F) -> ServiceChain<Map<Self, F, Req, Res>, Req>
where Self: Sized, F: Fn(Self::Response) -> Res,

Maps this service’s output to a different type, returning a new service. Read more
Source§

fn map_err<F, E>(self, f: F) -> ServiceChain<MapErr<Self, F, E>, Req>
where Self: Sized, F: Fn(Self::Error) -> E,

Maps this service’s error to a different type, returning a new service. Read more
Source§

impl<F> Service<Io<F>> for SslAcceptorService
where F: Filter,

Source§

type Response = Io<Layer<SslFilter, F>>

Responses given by the service.
Source§

type Error = Box<dyn Error>

Errors produced by the service when polling readiness or executing call.
Source§

async fn ready( &self, _: ServiceCtx<'_, SslAcceptorService>, ) -> Result<(), <SslAcceptorService as Service<Io<F>>>::Error>

Returns when the service is ready to process requests. Read more
Source§

async fn call( &self, io: Io<F>, _: ServiceCtx<'_, SslAcceptorService>, ) -> Result<<SslAcceptorService as Service<Io<F>>>::Response, <SslAcceptorService as Service<Io<F>>>::Error>

Processes a request and returns the response asynchronously. Read more
Source§

async fn shutdown(&self)

Shuts down the service. Read more
Source§

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

Polls the service from the current async task. Read more
Source§

fn map<F, Res>(self, f: F) -> ServiceChain<Map<Self, F, Req, Res>, Req>
where Self: Sized, F: Fn(Self::Response) -> Res,

Maps this service’s output to a different type, returning a new service. Read more
Source§

fn map_err<F, E>(self, f: F) -> ServiceChain<MapErr<Self, F, E>, Req>
where Self: Sized, F: Fn(Self::Error) -> E,

Maps this service’s error to a different type, returning a new service. Read more
Source§

impl<F> Service<Io<F>> for TlsAcceptorService
where F: Filter,

Source§

type Response = Io<Layer<TlsServerFilter, F>>

Responses given by the service.
Source§

type Error = Error

Errors produced by the service when polling readiness or executing call.
Source§

async fn ready( &self, _: ServiceCtx<'_, TlsAcceptorService>, ) -> Result<(), <TlsAcceptorService as Service<Io<F>>>::Error>

Returns when the service is ready to process requests. Read more
Source§

async fn call( &self, io: Io<F>, _: ServiceCtx<'_, TlsAcceptorService>, ) -> Result<<TlsAcceptorService as Service<Io<F>>>::Response, <TlsAcceptorService as Service<Io<F>>>::Error>

Processes a request and returns the response asynchronously. Read more
Source§

async fn shutdown(&self)

Shuts down the service. Read more
Source§

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

Polls the service from the current async task. Read more
Source§

fn map<F, Res>(self, f: F) -> ServiceChain<Map<Self, F, Req, Res>, Req>
where Self: Sized, F: Fn(Self::Response) -> Res,

Maps this service’s output to a different type, returning a new service. Read more
Source§

fn map_err<F, E>(self, f: F) -> ServiceChain<MapErr<Self, F, E>, Req>
where Self: Sized, F: Fn(Self::Error) -> E,

Maps this service’s error to a different type, returning a new service. Read more
Source§

impl<F, S, B, C> Service<Io<F>> for H1ServiceHandler<F, S, B, C>
where F: Filter, C: Service<Control<F, S::Error>, Response = ControlAck<F>> + 'static, C::Error: Error, S: Service<Request> + 'static, S::Error: ResponseError, S::Response: Into<Response<B>>, B: MessageBody,

Source§

type Response = ()

Responses given by the service.
Source§

type Error = DispatchError

Errors produced by the service when polling readiness or executing call.
Source§

async fn ready(&self, _: ServiceCtx<'_, Self>) -> Result<(), Self::Error>

Returns when the service is ready to process requests. Read more
Source§

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

Polls the service from the current async task. Read more
Source§

async fn shutdown(&self)

Shuts down the service. Read more
Source§

async fn call( &self, io: Io<F>, _: ServiceCtx<'_, Self>, ) -> Result<(), Self::Error>

Processes a request and returns the response asynchronously. Read more
Source§

fn map<F, Res>(self, f: F) -> ServiceChain<Map<Self, F, Req, Res>, Req>
where Self: Sized, F: Fn(Self::Response) -> Res,

Maps this service’s output to a different type, returning a new service. Read more
Source§

fn map_err<F, E>(self, f: F) -> ServiceChain<MapErr<Self, F, E>, Req>
where Self: Sized, F: Fn(Self::Error) -> E,

Maps this service’s error to a different type, returning a new service. Read more
Source§

impl<F: Filter> Service<Io<F>> for WsTransportService

Source§

type Response = Io<Layer<WsTransport, F>>

Responses given by the service.
Source§

type Error = Error

Errors produced by the service when polling readiness or executing call.
Source§

fn call( &self, io: Io<F>, _: ServiceCtx<'_, Self>, ) -> impl Future<Output = Result<Self::Response, Self::Error>>

Processes a request and returns the response asynchronously. Read more
Source§

async fn ready(&self, ctx: ServiceCtx<'_, Self>) -> Result<(), Self::Error>

Returns when the service is ready to process requests. Read more
Source§

async fn shutdown(&self)

Shuts down the service. Read more
Source§

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

Polls the service from the current async task. Read more
Source§

fn map<F, Res>(self, f: F) -> ServiceChain<Map<Self, F, Req, Res>, Req>
where Self: Sized, F: Fn(Self::Response) -> Res,

Maps this service’s output to a different type, returning a new service. Read more
Source§

fn map_err<F, E>(self, f: F) -> ServiceChain<MapErr<Self, F, E>, Req>
where Self: Sized, F: Fn(Self::Error) -> E,

Maps this service’s error to a different type, returning a new service. Read more
Source§

impl<F, Pub, Ctl> ServiceFactory<Io<F>, SharedCfg> for Server<Pub, Ctl>

Source§

type Response = ()

Responses given by the created services.
Source§

type Error = ServerError<()>

Errors produced by the created services.
Source§

type Service = ServerHandler<Pub, Ctl>

The type of Service produced by this factory.
Source§

type InitError = ()

Possible errors encountered during service construction.
Source§

async fn create( &self, cfg: SharedCfg, ) -> Result<<Server<Pub, Ctl> as ServiceFactory<Io<F>, SharedCfg>>::Service, <Server<Pub, Ctl> as ServiceFactory<Io<F>, SharedCfg>>::InitError>

Creates a new service asynchronously and returns it.
Source§

async fn pipeline( &self, cfg: Cfg, ) -> Result<Pipeline<Self::Service>, Self::InitError>
where Self: Sized,

Asynchronously creates a new service and wraps it in a container.
Source§

fn map<F, Res>( self, f: F, ) -> ServiceChainFactory<MapFactory<Self, F, Req, Res, Cfg>, Req, Cfg>
where Self: Sized, F: Fn(Self::Response) -> Res + Clone,

Returns a new service that maps this service’s output to a different type.
Source§

fn map_err<F, E>( self, f: F, ) -> ServiceChainFactory<MapErrFactory<Self, Req, Cfg, F, E>, Req, Cfg>
where Self: Sized, F: Fn(Self::Error) -> E + Clone,

Transforms this service’s error into another error, producing a new service.
Source§

fn map_init_err<F, E>( self, f: F, ) -> ServiceChainFactory<MapInitErr<Self, Req, Cfg, F, E>, Req, Cfg>
where Self: Sized, F: Fn(Self::InitError) -> E + Clone,

Maps this factory’s initialization error to a different error, returning a new service factory.
Source§

fn boxed( self, ) -> BoxServiceFactory<Cfg, Req, Self::Response, Self::Error, Self::InitError>
where Cfg: 'static, Req: 'static, Self: Sized + 'static,

Creates a boxed service factory.
Source§

impl<F> ServiceFactory<Io<F>, SharedCfg> for SslAcceptor
where F: Filter,

Source§

type Response = Io<Layer<SslFilter, F>>

Responses given by the created services.
Source§

type Error = Box<dyn Error>

Errors produced by the created services.
Source§

type Service = SslAcceptorService

The type of Service produced by this factory.
Source§

type InitError = ()

Possible errors encountered during service construction.
Source§

fn create( &self, cfg: SharedCfg, ) -> impl Future<Output = Result<<SslAcceptor as ServiceFactory<Io<F>, SharedCfg>>::Service, <SslAcceptor as ServiceFactory<Io<F>, SharedCfg>>::InitError>>

Creates a new service asynchronously and returns it.
Source§

async fn pipeline( &self, cfg: Cfg, ) -> Result<Pipeline<Self::Service>, Self::InitError>
where Self: Sized,

Asynchronously creates a new service and wraps it in a container.
Source§

fn map<F, Res>( self, f: F, ) -> ServiceChainFactory<MapFactory<Self, F, Req, Res, Cfg>, Req, Cfg>
where Self: Sized, F: Fn(Self::Response) -> Res + Clone,

Returns a new service that maps this service’s output to a different type.
Source§

fn map_err<F, E>( self, f: F, ) -> ServiceChainFactory<MapErrFactory<Self, Req, Cfg, F, E>, Req, Cfg>
where Self: Sized, F: Fn(Self::Error) -> E + Clone,

Transforms this service’s error into another error, producing a new service.
Source§

fn map_init_err<F, E>( self, f: F, ) -> ServiceChainFactory<MapInitErr<Self, Req, Cfg, F, E>, Req, Cfg>
where Self: Sized, F: Fn(Self::InitError) -> E + Clone,

Maps this factory’s initialization error to a different error, returning a new service factory.
Source§

fn boxed( self, ) -> BoxServiceFactory<Cfg, Req, Self::Response, Self::Error, Self::InitError>
where Cfg: 'static, Req: 'static, Self: Sized + 'static,

Creates a boxed service factory.
Source§

impl<F> ServiceFactory<Io<F>, SharedCfg> for TlsAcceptor
where F: Filter,

Source§

type Response = Io<Layer<TlsServerFilter, F>>

Responses given by the created services.
Source§

type Error = Error

Errors produced by the created services.
Source§

type Service = TlsAcceptorService

The type of Service produced by this factory.
Source§

type InitError = ()

Possible errors encountered during service construction.
Source§

fn create( &self, cfg: SharedCfg, ) -> impl Future<Output = Result<<TlsAcceptor as ServiceFactory<Io<F>, SharedCfg>>::Service, <TlsAcceptor as ServiceFactory<Io<F>, SharedCfg>>::InitError>>

Creates a new service asynchronously and returns it.
Source§

async fn pipeline( &self, cfg: Cfg, ) -> Result<Pipeline<Self::Service>, Self::InitError>
where Self: Sized,

Asynchronously creates a new service and wraps it in a container.
Source§

fn map<F, Res>( self, f: F, ) -> ServiceChainFactory<MapFactory<Self, F, Req, Res, Cfg>, Req, Cfg>
where Self: Sized, F: Fn(Self::Response) -> Res + Clone,

Returns a new service that maps this service’s output to a different type.
Source§

fn map_err<F, E>( self, f: F, ) -> ServiceChainFactory<MapErrFactory<Self, Req, Cfg, F, E>, Req, Cfg>
where Self: Sized, F: Fn(Self::Error) -> E + Clone,

Transforms this service’s error into another error, producing a new service.
Source§

fn map_init_err<F, E>( self, f: F, ) -> ServiceChainFactory<MapInitErr<Self, Req, Cfg, F, E>, Req, Cfg>
where Self: Sized, F: Fn(Self::InitError) -> E + Clone,

Maps this factory’s initialization error to a different error, returning a new service factory.
Source§

fn boxed( self, ) -> BoxServiceFactory<Cfg, Req, Self::Response, Self::Error, Self::InitError>
where Cfg: 'static, Req: 'static, Self: Sized + 'static,

Creates a boxed service factory.
Source§

impl<F, S, B, C1, C2> ServiceFactory<Io<F>, SharedCfg> for HttpService<F, S, B, C1, C2>
where F: Filter, S: ServiceFactory<Request, SharedCfg> + 'static, S::Error: ResponseError, S::InitError: Debug, S::Response: Into<Response<B>>, B: MessageBody, C1: ServiceFactory<Control<F, S::Error>, SharedCfg, Response = ControlAck<F>> + 'static, C1::Error: Error, C1::InitError: Debug, C2: ServiceFactory<Control<H2Error>, SharedCfg, Response = ControlAck> + 'static, C2::Error: Error, C2::InitError: Debug,

Source§

type Response = ()

Responses given by the created services.
Source§

type Error = DispatchError

Errors produced by the created services.
Source§

type InitError = ()

Possible errors encountered during service construction.
Source§

type Service = HttpServiceHandler<F, <S as ServiceFactory<Request, SharedCfg>>::Service, B, <C1 as ServiceFactory<Control<F, <S as ServiceFactory<Request, SharedCfg>>::Error>, SharedCfg>>::Service, C2>

The type of Service produced by this factory.
Source§

async fn create(&self, cfg: SharedCfg) -> Result<Self::Service, Self::InitError>

Creates a new service asynchronously and returns it.
Source§

async fn pipeline( &self, cfg: Cfg, ) -> Result<Pipeline<Self::Service>, Self::InitError>
where Self: Sized,

Asynchronously creates a new service and wraps it in a container.
Source§

fn map<F, Res>( self, f: F, ) -> ServiceChainFactory<MapFactory<Self, F, Req, Res, Cfg>, Req, Cfg>
where Self: Sized, F: Fn(Self::Response) -> Res + Clone,

Returns a new service that maps this service’s output to a different type.
Source§

fn map_err<F, E>( self, f: F, ) -> ServiceChainFactory<MapErrFactory<Self, Req, Cfg, F, E>, Req, Cfg>
where Self: Sized, F: Fn(Self::Error) -> E + Clone,

Transforms this service’s error into another error, producing a new service.
Source§

fn map_init_err<F, E>( self, f: F, ) -> ServiceChainFactory<MapInitErr<Self, Req, Cfg, F, E>, Req, Cfg>
where Self: Sized, F: Fn(Self::InitError) -> E + Clone,

Maps this factory’s initialization error to a different error, returning a new service factory.
Source§

fn boxed( self, ) -> BoxServiceFactory<Cfg, Req, Self::Response, Self::Error, Self::InitError>
where Cfg: 'static, Req: 'static, Self: Sized + 'static,

Creates a boxed service factory.
Source§

impl<F, S, B, C> ServiceFactory<Io<F>, SharedCfg> for H1Service<F, S, B, C>
where F: Filter, S: ServiceFactory<Request, SharedCfg> + 'static, S::Error: ResponseError, S::Response: Into<Response<B>>, S::InitError: Debug, B: MessageBody, C: ServiceFactory<Control<F, S::Error>, SharedCfg, Response = ControlAck<F>> + 'static, C::Error: Error, C::InitError: Debug,

Source§

type Response = ()

Responses given by the created services.
Source§

type Error = DispatchError

Errors produced by the created services.
Source§

type InitError = ()

Possible errors encountered during service construction.
Source§

type Service = H1ServiceHandler<F, <S as ServiceFactory<Request, SharedCfg>>::Service, B, <C as ServiceFactory<Control<F, <S as ServiceFactory<Request, SharedCfg>>::Error>, SharedCfg>>::Service>

The type of Service produced by this factory.
Source§

async fn create(&self, cfg: SharedCfg) -> Result<Self::Service, Self::InitError>

Creates a new service asynchronously and returns it.
Source§

async fn pipeline( &self, cfg: Cfg, ) -> Result<Pipeline<Self::Service>, Self::InitError>
where Self: Sized,

Asynchronously creates a new service and wraps it in a container.
Source§

fn map<F, Res>( self, f: F, ) -> ServiceChainFactory<MapFactory<Self, F, Req, Res, Cfg>, Req, Cfg>
where Self: Sized, F: Fn(Self::Response) -> Res + Clone,

Returns a new service that maps this service’s output to a different type.
Source§

fn map_err<F, E>( self, f: F, ) -> ServiceChainFactory<MapErrFactory<Self, Req, Cfg, F, E>, Req, Cfg>
where Self: Sized, F: Fn(Self::Error) -> E + Clone,

Transforms this service’s error into another error, producing a new service.
Source§

fn map_init_err<F, E>( self, f: F, ) -> ServiceChainFactory<MapInitErr<Self, Req, Cfg, F, E>, Req, Cfg>
where Self: Sized, F: Fn(Self::InitError) -> E + Clone,

Maps this factory’s initialization error to a different error, returning a new service factory.
Source§

fn boxed( self, ) -> BoxServiceFactory<Cfg, Req, Self::Response, Self::Error, Self::InitError>
where Cfg: 'static, Req: 'static, Self: Sized + 'static,

Creates a boxed service factory.
Source§

impl<F, S, B, C> ServiceFactory<Io<F>, SharedCfg> for H2Service<F, S, B, C>

Source§

type Response = ()

Responses given by the created services.
Source§

type Error = DispatchError

Errors produced by the created services.
Source§

type InitError = ()

Possible errors encountered during service construction.
Source§

type Service = H2ServiceHandler<F, <S as ServiceFactory<Request, SharedCfg>>::Service, B, C>

The type of Service produced by this factory.
Source§

async fn create(&self, cfg: SharedCfg) -> Result<Self::Service, Self::InitError>

Creates a new service asynchronously and returns it.
Source§

async fn pipeline( &self, cfg: Cfg, ) -> Result<Pipeline<Self::Service>, Self::InitError>
where Self: Sized,

Asynchronously creates a new service and wraps it in a container.
Source§

fn map<F, Res>( self, f: F, ) -> ServiceChainFactory<MapFactory<Self, F, Req, Res, Cfg>, Req, Cfg>
where Self: Sized, F: Fn(Self::Response) -> Res + Clone,

Returns a new service that maps this service’s output to a different type.
Source§

fn map_err<F, E>( self, f: F, ) -> ServiceChainFactory<MapErrFactory<Self, Req, Cfg, F, E>, Req, Cfg>
where Self: Sized, F: Fn(Self::Error) -> E + Clone,

Transforms this service’s error into another error, producing a new service.
Source§

fn map_init_err<F, E>( self, f: F, ) -> ServiceChainFactory<MapInitErr<Self, Req, Cfg, F, E>, Req, Cfg>
where Self: Sized, F: Fn(Self::InitError) -> E + Clone,

Maps this factory’s initialization error to a different error, returning a new service factory.
Source§

fn boxed( self, ) -> BoxServiceFactory<Cfg, Req, Self::Response, Self::Error, Self::InitError>
where Cfg: 'static, Req: 'static, Self: Sized + 'static,

Creates a boxed service factory.

Auto Trait Implementations§

§

impl<F = Base> !Freeze for Io<F>

§

impl<F = Base> !RefUnwindSafe for Io<F>

§

impl<F = Base> !Send for Io<F>

§

impl<F = Base> !Sync for Io<F>

§

impl<F = Base> !UnwindSafe for Io<F>

§

impl<F> Unpin for Io<F>
where F: Unpin,

§

impl<F> UnsafeUnpin for Io<F>

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, 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<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

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

Source§

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>,

Source§

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.