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.
pub fn open_streams(&self) -> usize
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Connection
impl RefUnwindSafe for Connection
impl Send for Connection
impl Sync for Connection
impl Unpin for Connection
impl UnsafeUnpin for Connection
impl UnwindSafe for Connection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more