pub struct Connection { /* private fields */ }Implementations§
Source§impl Connection
impl Connection
pub fn new() -> Self
Sourcepub fn start(&mut self, out: &mut [u8]) -> Result<usize, Error>
pub fn start(&mut self, out: &mut [u8]) -> Result<usize, Error>
Write the client preface, our settings, and the connection-level window update that stops a large response stalling at 65535 bytes.
Sourcepub fn request(
&mut self,
method: &str,
path: &str,
authority: &str,
scheme: &str,
extra: &[(&str, &str)],
body: &[u8],
out: &mut [u8],
) -> Result<(u32, usize), Error>
pub fn request( &mut self, method: &str, path: &str, authority: &str, scheme: &str, extra: &[(&str, &str)], body: &[u8], out: &mut [u8], ) -> Result<(u32, usize), Error>
Open a stream and send a request, headers and body together.
Returns the stream identifier and how many bytes were written.
Sourcepub fn recv<'a>(
&mut self,
bytes: &'a [u8],
on_header: impl FnMut(&str, &str),
out: &mut [u8],
) -> Result<(Event<'a>, usize), Error>
pub fn recv<'a>( &mut self, bytes: &'a [u8], on_header: impl FnMut(&str, &str), out: &mut [u8], ) -> Result<(Event<'a>, usize), Error>
Consume one whole frame.
frame is the nine-byte header followed by exactly its payload. Replies
this connection owes — settings and ping acknowledgements, window updates
— are written to out, and the caller must send them.
Sourcepub fn finish_data(
&mut self,
header: FrameHeader,
out: &mut [u8],
) -> Result<usize, Error>
pub fn finish_data( &mut self, header: FrameHeader, out: &mut [u8], ) -> Result<usize, Error>
Complete a DATA frame whose payload was consumed incrementally by the transport adapter.
DATA does not affect HPACK state, so constrained adapters can stream a large payload without retaining the complete frame. Flow-control credit and stream closure still happen exactly once, after every payload byte (including padding) has been authenticated and consumed.