pub struct Http2Session { /* private fields */ }Expand description
A single-threaded, incremental HTTP/2 connection with no socket ownership.
Implementations§
Source§impl Http2Session
impl Http2Session
Source§impl Http2Session
impl Http2Session
Sourcepub fn submit_request(
&mut self,
fields: &[HeaderField<'_>],
provider: Option<DataProvider>,
) -> Result<i32, ProtocolError>
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.
Sourcepub fn submit_response(
&mut self,
id: i32,
fields: &[HeaderField<'_>],
provider: Option<DataProvider>,
) -> Result<(), ProtocolError>
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.
Sourcepub fn submit_headers(
&mut self,
flags: u8,
id: i32,
fields: &[HeaderField<'_>],
) -> Result<(), ProtocolError>
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.
Sourcepub fn submit_trailer(
&mut self,
id: i32,
fields: &[HeaderField<'_>],
) -> Result<(), ProtocolError>
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.
Sourcepub fn resume_data(&mut self, id: i32) -> Result<(), ProtocolError>
pub fn resume_data(&mut self, id: i32) -> Result<(), ProtocolError>
Sourcepub fn submit_rst_stream(
&mut self,
id: i32,
code: u32,
) -> Result<(), ProtocolError>
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.
Sourcepub fn submit_goaway(
&mut self,
last: i32,
code: u32,
debug: &[u8],
) -> Result<(), ProtocolError>
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§impl Http2Session
impl Http2Session
Sourcepub fn new(role: Http2Role, local: Http2Settings) -> Result<Self, ProtocolError>
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.
pub const fn role(&self) -> Http2Role
pub const fn last_proc_stream_id(&self) -> i32
pub fn next_event(&mut self) -> Option<SessionEvent>
pub fn want_read(&self) -> bool
pub fn want_write(&self) -> bool
Sourcepub fn release_stream(&mut self, id: i32) -> Result<(), ProtocolError>
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.