pub struct Datagram { /* private fields */ }
Available on crate feature
experimental-udp
only.Expand description
A Datagram message represents data sent along a UDP stream.
Upon receiving a Datagram message for a live stream, the client or exit sends that data onto the associated UDP connection.
These messages hold between 1 and Datagram::MAXLEN bytes of data each.
Implementations§
source§impl Datagram
impl Datagram
sourcepub const MAXLEN: usize = 498usize
pub const MAXLEN: usize = 498usize
NOTE: Proposal 340, fragmented relay message, might change this value reality. The longest allowable body length for a single data cell.
sourcepub fn new(inp: &[u8]) -> Result<Self>
pub fn new(inp: &[u8]) -> Result<Self>
Construct a new data cell.
Returns an error if inp
is longer than Datagram::MAXLEN
bytes.
Trait Implementations§
source§impl Body for Datagram
impl Body for Datagram
source§fn decode_from_reader(r: &mut Reader<'_>) -> Result<Self>
fn decode_from_reader(r: &mut Reader<'_>) -> Result<Self>
Decode a relay cell body from a provided reader.
source§fn encode_onto<W: Writer + ?Sized>(self, w: &mut W) -> EncodeResult<()>
fn encode_onto<W: Writer + ?Sized>(self, w: &mut W) -> EncodeResult<()>
Encode the body of this cell into the end of a writer.
source§impl From<Datagram> for AnyRelayMsg
impl From<Datagram> for AnyRelayMsg
source§fn from(m: Datagram) -> AnyRelayMsg
fn from(m: Datagram) -> AnyRelayMsg
Converts to this type from the input type.
Auto Trait Implementations§
impl Freeze for Datagram
impl RefUnwindSafe for Datagram
impl Send for Datagram
impl Sync for Datagram
impl Unpin for Datagram
impl UnwindSafe for Datagram
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
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> ToHex for T
impl<T> ToHex for T
source§fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self
into the result. Lower case
letters are used (e.g. f9b4ca
)source§fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
fn encode_hex_upper<U>(&self) -> Uwhere
U: FromIterator<char>,
Encode the hex strict representing
self
into the result. Upper case
letters are used (e.g. F9B4CA
)