Struct tor_cell::relaycell::RelayMsgOuter
source · pub struct RelayMsgOuter<M> { /* private fields */ }
Expand description
A decoded and parsed relay message, along with an optional Stream ID.
This type represents a message that can be sent along a circuit, along with the ID for an associated stream that the message is meant for.
NOTE: This name is a placeholder; we intend to replace it once we have standardized our vocabulary in this area.
Implementations§
source§impl<M: RelayMsg> RelayMsgOuter<M>
impl<M: RelayMsg> RelayMsgOuter<M>
sourcepub fn into_streamid_and_msg(self) -> (Option<StreamId>, M)
pub fn into_streamid_and_msg(self) -> (Option<StreamId>, M)
Consume this cell and return its components.
sourcepub fn stream_id(&self) -> Option<StreamId>
pub fn stream_id(&self) -> Option<StreamId>
Return the stream ID for the stream that this cell corresponds to.
sourcepub fn encode<R: Rng + CryptoRng>(self, rng: &mut R) -> Result<BoxedCellBody>
pub fn encode<R: Rng + CryptoRng>(self, rng: &mut R) -> Result<BoxedCellBody>
Consume this relay message and encode it as a 509-byte padded cell body.
sourcepub fn decode_singleton(
version: RelayCellFormat,
body: BoxedCellBody
) -> Result<Self>
pub fn decode_singleton( version: RelayCellFormat, body: BoxedCellBody ) -> Result<Self>
Parse a RELAY or RELAY_EARLY cell body into a RelayMsgOuter. Requires that the cryptographic checks on the message have already been performed
Fails if the cell doesn’t contain exactly one message.
Non-test code should generally use RelayCellDecoder
instead.
Trait Implementations§
Auto Trait Implementations§
impl<M> Freeze for RelayMsgOuter<M>where
M: Freeze,
impl<M> RefUnwindSafe for RelayMsgOuter<M>where
M: RefUnwindSafe,
impl<M> Send for RelayMsgOuter<M>where
M: Send,
impl<M> Sync for RelayMsgOuter<M>where
M: Sync,
impl<M> Unpin for RelayMsgOuter<M>where
M: Unpin,
impl<M> UnwindSafe for RelayMsgOuter<M>where
M: UnwindSafe,
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
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> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more