Skip to main content

H1Connection

Struct H1Connection 

Source
pub struct H1Connection<Transport> { /* private fields */ }
Expand description

An HTTP/1.x connection on one transport.

Configure it with the with_* methods, then call run with a handler to serve requests on it.

Implementations§

Source§

impl<Transport> H1Connection<Transport>

Source

pub fn new(context: Arc<HttpContext>, transport: Transport) -> Self

An HTTP/1.x connection on transport, sharing context with the rest of the server.

Source

pub fn with_initial_bytes(self, initial_bytes: Vec<u8>) -> Self

Bytes already read from the transport, such as those read while checking for an HTTP/2 connection preface. They’re parsed as the start of the first request, before anything else is read.

Source§

impl<Transport> H1Connection<Transport>
where Transport: AsyncRead + AsyncWrite + Unpin + Send + Sync + 'static,

Source

pub async fn run<Handler, Fut>( self, handler: Handler, ) -> H1ConnectionResult<Transport>
where Handler: FnMut(Conn<Transport>) -> Fut, Fut: Future<Output = Conn<Transport>>,

Serve requests on this connection, calling handler once for each, until the connection closes, upgrades, or fails.

Trait Implementations§

Source§

impl<Transport> Debug for H1Connection<Transport>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<Transport> !RefUnwindSafe for H1Connection<Transport>

§

impl<Transport> !UnwindSafe for H1Connection<Transport>

§

impl<Transport> Freeze for H1Connection<Transport>
where Transport: Freeze,

§

impl<Transport> Send for H1Connection<Transport>
where Transport: Send,

§

impl<Transport> Sync for H1Connection<Transport>
where Transport: Sync,

§

impl<Transport> Unpin for H1Connection<Transport>
where Transport: Unpin,

§

impl<Transport> UnsafeUnpin for H1Connection<Transport>
where Transport: UnsafeUnpin,

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<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.