Trait hyperdriver::server::Protocol

source ·
pub trait Protocol<S, IO> {
    type Error: Into<Box<dyn Error + Send + Sync>>;
    type Connection: Connection + Future<Output = Result<(), Self::Error>> + Send + 'static;

    // Required method
    fn serve_connection_with_upgrades(
        &self,
        stream: IO,
        service: S,
    ) -> Self::Connection;
}
Available on crate feature server only.
Expand description

A transport protocol for serving connections.

This is not meant to be the “accept” part of a server, but instead the connection management and serving part.

Required Associated Types§

source

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

The error when a connection has a problem.

source

type Connection: Connection + Future<Output = Result<(), Self::Error>> + Send + 'static

The connection future, used to drive a connection IO to completion.

Required Methods§

source

fn serve_connection_with_upgrades( &self, stream: IO, service: S, ) -> Self::Connection

Serve a connection with possible upgrades.

Implementing this method does not guarantee that a protocol can be upgraded, just that we can serve the connection.

Implementors§

source§

impl<S, IO> Protocol<S, IO> for hyperdriver::server::conn::auto::Builder<TokioExecutor>
where S: Service<Request, Response = Response> + Clone + Send + 'static, S::Future: Send + 'static, S::Error: Into<Box<dyn Error + Send + Sync>>, IO: AsyncRead + AsyncWrite + Send + Unpin + 'static,

§

type Connection = Connecting<S, IO>

§

type Error = ConnectionError

source§

impl<S, IO> Protocol<S, IO> for hyperdriver::server::conn::http1::Builder
where S: Service<Request, Response = Response> + Clone + Send + 'static, S::Future: Send + 'static, S::Error: Into<Box<dyn Error + Send + Sync>>, IO: AsyncRead + AsyncWrite + Send + Unpin + 'static,

source§

impl<S, IO> Protocol<S, IO> for hyperdriver::server::conn::http2::Builder<TokioExecutor>
where S: Service<Request, Response = Response> + Clone + Send + 'static, S::Future: Send + 'static, S::Error: Into<Box<dyn Error + Send + Sync>>, IO: AsyncRead + AsyncWrite + Send + Unpin + 'static,