pub struct Datagram<'a> { /* private fields */ }Expand description
An HTTP3 datagram.
Implementations§
Source§impl<'a> Datagram<'a>
impl<'a> Datagram<'a>
Sourcepub fn new(qstream_id: QStreamId, payload: &'a [u8]) -> Self
pub fn new(qstream_id: QStreamId, payload: &'a [u8]) -> Self
Creates a new Datagram with a given payload.
Sourcepub fn read(quic_datagram: &'a [u8]) -> Result<Self, ErrorCode>
pub fn read(quic_datagram: &'a [u8]) -> Result<Self, ErrorCode>
Reads Datagram from a QUIC datagram.
Sourcepub fn write(&self, buffer: &mut [u8]) -> Result<usize, EndOfBuffer>
pub fn write(&self, buffer: &mut [u8]) -> Result<usize, EndOfBuffer>
Writes a Datagram as QUIC datagram into buffer.
It returns the number of bytes written.
It returns Err if the buffer does not have enough capacity.
See Self::write_size.
In case of Err, buffer is not written.
Sourcepub fn write_size(&self) -> usize
pub fn write_size(&self) -> usize
Returns the needed capacity to write this datagram into a buffer.
Sourcepub fn header_size(qstream_id: QStreamId) -> usize
pub fn header_size(qstream_id: QStreamId) -> usize
Returns the HTTP3 header.
Computes the space overhead (HTTP3 header) due to the qstream_id
encoding into an HTTP3 datagram.
Sourcepub fn qstream_id(&self) -> QStreamId
pub fn qstream_id(&self) -> QStreamId
Returns the associated QStreamId.
Auto Trait Implementations§
impl<'a> Freeze for Datagram<'a>
impl<'a> RefUnwindSafe for Datagram<'a>
impl<'a> Send for Datagram<'a>
impl<'a> Sync for Datagram<'a>
impl<'a> Unpin for Datagram<'a>
impl<'a> UnwindSafe for Datagram<'a>
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