Trait s2n_quic_core::datagram::traits::Packet
source · pub trait Packet {
// Required methods
fn remaining_capacity(&self) -> usize;
fn write_datagram(&mut self, data: &[u8]) -> Result<(), WriteError>;
fn write_datagram_vectored(
&mut self,
data: &[&[u8]]
) -> Result<(), WriteError>;
fn has_pending_streams(&self) -> bool;
fn datagrams_prioritized(&self) -> bool;
}
Expand description
A packet will be available during the on_transmit callback. Use the methods defined here to interrogate the packet struct and write datagrams to the packet.
Required Methods§
sourcefn remaining_capacity(&self) -> usize
fn remaining_capacity(&self) -> usize
Returns the remaining space in the packet left to write datagrams
sourcefn write_datagram(&mut self, data: &[u8]) -> Result<(), WriteError>
fn write_datagram(&mut self, data: &[u8]) -> Result<(), WriteError>
Writes a single datagram to a packet. This function should be called per datagram.
sourcefn write_datagram_vectored(&mut self, data: &[&[u8]]) -> Result<(), WriteError>
fn write_datagram_vectored(&mut self, data: &[&[u8]]) -> Result<(), WriteError>
Writes a single datagram to a packet from a collection of buffers. This function should be called per datagram.
sourcefn has_pending_streams(&self) -> bool
fn has_pending_streams(&self) -> bool
Returns whether or not there is reliable data waiting to be sent.
Use method to decide whether or not to cede the packet space to the stream data.
sourcefn datagrams_prioritized(&self) -> bool
fn datagrams_prioritized(&self) -> bool
Returns whether or not datagrams are prioritized in this packet or not.
Datagrams get prioritized every other packet, which gives the application the best chance to send a large datagram.