Datagram

Struct Datagram 

Source
pub struct Datagram<'a> { /* private fields */ }
Expand description

An HTTP3 datagram.

Implementations§

Source§

impl<'a> Datagram<'a>

Source

pub fn new(qstream_id: QStreamId, payload: &'a [u8]) -> Self

Creates a new Datagram with a given payload.

Source

pub fn read(quic_datagram: &'a [u8]) -> Result<Self, ErrorCode>

Reads Datagram from a QUIC datagram.

Source

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.

Source

pub fn write_size(&self) -> usize

Returns the needed capacity to write this datagram into a buffer.

Source

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.

Source

pub fn qstream_id(&self) -> QStreamId

Returns the associated QStreamId.

Source

pub fn payload(&self) -> &[u8]

Returns the payload.

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.