Skip to main content

Http2Session

Struct Http2Session 

Source
pub struct Http2Session { /* private fields */ }
Expand description

A single-threaded, incremental HTTP/2 connection with no socket ownership.

Implementations§

Source§

impl Http2Session

Source

pub fn mem_recv(&mut self, bytes: &[u8]) -> Result<usize, ProtocolError>

Feeds wire bytes, retaining incomplete prefaces, frames and header blocks.

§Errors

Connection errors are sticky; malformed streams produce stream-local events.

Source

pub fn consume(&mut self, id: i32, amount: usize) -> Result<(), ProtocolError>

Returns application-consumed bytes to both receive windows in bounded batches.

§Errors

Rejects unknown streams and credit exceeding delivered DATA bytes.

Source§

impl Http2Session

Source

pub fn submit_request( &mut self, fields: &[HeaderField<'_>], provider: Option<DataProvider>, ) -> Result<i32, ProtocolError>

Opens a client stream, retaining the body source until EOF or reset.

§Errors

Rejects draining connections, exhausted IDs and peer concurrency limits.

Source

pub fn submit_response( &mut self, id: i32, fields: &[HeaderField<'_>], provider: Option<DataProvider>, ) -> Result<(), ProtocolError>

Queues response headers, with an optional incremental body producer.

§Errors

Rejects unknown or closed streams and invalid outgoing headers.

Source

pub fn submit_headers( &mut self, flags: u8, id: i32, fields: &[HeaderField<'_>], ) -> Result<(), ProtocolError>

Queues an informational or final header block with explicit END_STREAM.

§Errors

Rejects unknown or closed streams and invalid outgoing headers.

Source

pub fn submit_trailer( &mut self, id: i32, fields: &[HeaderField<'_>], ) -> Result<(), ProtocolError>

Queues the final trailer block after the body source has finished.

§Errors

Rejects closed streams or a body source that has not reached EOF.

Source

pub fn resume_data(&mut self, id: i32) -> Result<(), ProtocolError>

Resumes a body source that returned Deferred.

§Errors

Rejects unknown or reset streams.

Source

pub fn submit_rst_stream( &mut self, id: i32, code: u32, ) -> Result<(), ProtocolError>

Queues a reset without discarding previously encoded HPACK context.

§Errors

Rejects an unknown stream.

Source

pub fn submit_goaway( &mut self, last: i32, code: u32, debug: &[u8], ) -> Result<(), ProtocolError>

Starts graceful shutdown while allowing accepted streams to finish.

§Errors

Rejects invalid boundaries and oversized debug payloads.

Source

pub fn mem_send(&mut self) -> Result<&[u8], ProtocolError>

Serializes one queued control/header block or one flow-controlled DATA frame.

§Errors

Returns a sticky connection failure or an invalid body-source result.

Source§

impl Http2Session

Source

pub fn new(role: Http2Role, local: Http2Settings) -> Result<Self, ProtocolError>

Creates a peer and queues its connection preface and local settings.

§Errors

Rejects invalid frame and flow-control window sizes.

Source

pub const fn role(&self) -> Http2Role

Source

pub const fn last_proc_stream_id(&self) -> i32

Source

pub fn next_event(&mut self) -> Option<SessionEvent>

Source

pub fn want_read(&self) -> bool

Source

pub fn want_write(&self) -> bool

Source

pub fn release_stream(&mut self, id: i32) -> Result<(), ProtocolError>

Releases a closed stream’s protocol bookkeeping.

§Errors

Rejects removal before the closure event has been emitted.

Auto Trait Implementations§

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> Same for T

Source§

type Output = T

Should always be Self
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.