pub struct UnparsedRelayMsg {
internal: UnparsedRelayMsgInternal,
}
Expand description
An enveloped relay message that has not yet been fully parsed, but where we have access to the command, stream ID, and payload data length for dispatching and congestion control purposes.
Fields§
§internal: UnparsedRelayMsgInternal
The internal representation.
Implementations§
Source§impl UnparsedRelayMsg
impl UnparsedRelayMsg
Sourcepub fn from_singleton_body(
version: RelayCellFormat,
body: BoxedCellBody,
) -> Result<Self>
pub fn from_singleton_body( version: RelayCellFormat, body: BoxedCellBody, ) -> Result<Self>
Wrap a BoxedCellBody as an UnparsedRelayMsg.
Fails if the body doesn’t correspond to exactly one relay message, but doesn’t parse the message itself.
Non-test code should generally use RelayCellDecoder
instead.
Sourcepub fn stream_id(&self) -> Option<StreamId>
pub fn stream_id(&self) -> Option<StreamId>
Return the stream ID for the stream that this msg corresponds to, if any.
Sourcepub fn data_len(&self) -> Result<u16>
pub fn data_len(&self) -> Result<u16>
Return the “length” field of a data cell, or 0 if not a data cell.
This is the size of the cell data (the “data” field), not the size of the cell.
If the field value is invalid (for example >509 for V0 cells), an error will be returned.
Sourcepub fn decode<M: RelayMsg>(self) -> Result<RelayMsgOuter<M>>
pub fn decode<M: RelayMsg>(self) -> Result<RelayMsgOuter<M>>
Decode this unparsed cell into a given cell type.
Trait Implementations§
Source§impl Clone for UnparsedRelayMsg
impl Clone for UnparsedRelayMsg
Source§fn clone(&self) -> UnparsedRelayMsg
fn clone(&self) -> UnparsedRelayMsg
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for UnparsedRelayMsg
impl Debug for UnparsedRelayMsg
Source§impl HasMemoryCostStructural for UnparsedRelayMsg
impl HasMemoryCostStructural for UnparsedRelayMsg
Source§fn indirect_memory_cost(&self, et: EnabledToken) -> usize
fn indirect_memory_cost(&self, et: EnabledToken) -> usize
Auto Trait Implementations§
impl Freeze for UnparsedRelayMsg
impl RefUnwindSafe for UnparsedRelayMsg
impl Send for UnparsedRelayMsg
impl Sync for UnparsedRelayMsg
impl Unpin for UnparsedRelayMsg
impl UnwindSafe for UnparsedRelayMsg
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§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> HasMemoryCost for Twhere
T: HasMemoryCostStructural,
impl<T> HasMemoryCost for Twhere
T: HasMemoryCostStructural,
§fn memory_cost(&self, et: EnabledToken) -> usize
fn memory_cost(&self, et: EnabledToken) -> usize
self
, in bytes Read more§impl<T> HasTypedMemoryCost<T> for Twhere
T: HasMemoryCost,
impl<T> HasTypedMemoryCost<T> for Twhere
T: HasMemoryCost,
§fn typed_memory_cost(&self, enabled: EnabledToken) -> TypedMemoryCost<T>
fn typed_memory_cost(&self, enabled: EnabledToken) -> TypedMemoryCost<T>
TypedMemoryCost<T>
rather than a raw usize
§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