pub struct RelayMsgOuter<M> {
streamid: Option<StreamId>,
msg: M,
}
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.
Fields§
§streamid: Option<StreamId>
The stream ID for the stream that this cell corresponds to.
msg: M
The relay message for this cell.
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,
format: RelayCellFormat,
rng: &mut R,
) -> Result<BoxedCellBody>
pub fn encode<R: Rng + CryptoRng>( self, format: RelayCellFormat, rng: &mut R, ) -> Result<BoxedCellBody>
Consume this relay message and encode it as a 509-byte padded cell body.
Sourcefn encode_to_cell_v0(self) -> EncodeResult<(BoxedCellBody, usize)>
fn encode_to_cell_v0(self) -> EncodeResult<(BoxedCellBody, usize)>
Consume a relay cell and return its contents, encoded for use in a RELAY or RELAY_EARLY cell.
Sourcefn encode_to_cell_v1(self) -> EncodeResult<(BoxedCellBody, usize)>
fn encode_to_cell_v1(self) -> EncodeResult<(BoxedCellBody, usize)>
Consume a relay cell and return its contents, encoded for use in a RELAY or RELAY_EARLY cell.
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.
Sourcefn decode_v0_from_reader(r: &mut Reader<'_>) -> Result<Self>
fn decode_v0_from_reader(r: &mut Reader<'_>) -> Result<Self>
Parse a RelayCellFormat::V0
RELAY or RELAY_EARLY cell body into a
RelayMsgOuter from a reader.
Requires that the cryptographic checks on the message have already been performed
Sourcefn decode_v1_from_reader(r: &mut Reader<'_>) -> Result<Self>
fn decode_v1_from_reader(r: &mut Reader<'_>) -> Result<Self>
Parse a RelayCellFormat::V1
RELAY or RELAY_EARLY cell body into a
RelayMsgOuter from a reader.
Requires that the cryptographic checks on the message have already been performed.
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§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
, which can then be
downcast
into Box<dyn ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
, which can then be further
downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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