pub struct Relay {
body: BoxedCellBody,
}
Expand description
A Relay cell - that is, one transmitted over a circuit.
Once a circuit has been established, relay cells can be sent over it. Clients can send relay cells to any relay on the circuit. Any relay on the circuit can send relay cells to the client, either directly (if it is the first hop), or indirectly through the intermediate hops.
A different protocol is defined over the relay cells; it is implemented in the crate::relaycell module.
Fields§
§body: BoxedCellBody
The contents of the relay cell as encoded for transfer.
TODO(nickm): It’s nice that this is boxed, since we don’t want to copy cell data all over the place. But unfortunately, there are some other places where we don’t Box things that we should, and more copies than necessary happen. We should refactor our data handling until we’re mostly moving around pointers rather than copying data; see ticket #7.
Implementations§
Source§impl Relay
impl Relay
Sourcepub fn from_raw(body: RawCellBody) -> Self
pub fn from_raw(body: RawCellBody) -> Self
Construct a Relay message from its body.
Sourcepub fn into_relay_body(self) -> BoxedCellBody
pub fn into_relay_body(self) -> BoxedCellBody
Consume this Relay message and return a BoxedCellBody for encryption/decryption.
Sourcepub fn into_early(self) -> AnyChanMsg
pub fn into_early(self) -> AnyChanMsg
Wrap this Relay message into a RelayMsg as a RELAY_EARLY cell.
Trait Implementations§
Source§impl Body for Relay
impl Body for Relay
Source§fn encode_onto<W: Writer + ?Sized>(self, w: &mut W) -> EncodeResult<()>
fn encode_onto<W: Writer + ?Sized>(self, w: &mut W) -> EncodeResult<()>
w
. Read moreSource§fn decode_from_reader(r: &mut Reader<'_>) -> Result<Self>
fn decode_from_reader(r: &mut Reader<'_>) -> Result<Self>
Source§impl ChanMsg for Relay
impl ChanMsg for Relay
Source§fn encode_onto<W: Writer + ?Sized>(self, w: &mut W) -> EncodeResult<()>
fn encode_onto<W: Writer + ?Sized>(self, w: &mut W) -> EncodeResult<()>
Source§impl From<Box<[u8; 509]>> for Relay
impl From<Box<[u8; 509]>> for Relay
Source§fn from(value: BoxedCellBody) -> Self
fn from(value: BoxedCellBody) -> Self
Source§impl From<Relay> for AnyChanMsg
impl From<Relay> for AnyChanMsg
Source§fn from(m: Relay) -> AnyChanMsg
fn from(m: Relay) -> AnyChanMsg
Source§impl From<Relay> for RelayEarly
impl From<Relay> for RelayEarly
Source§impl From<RelayEarly> for Relay
impl From<RelayEarly> for Relay
Source§fn from(value: RelayEarly) -> Self
fn from(value: RelayEarly) -> Self
Auto Trait Implementations§
impl Freeze for Relay
impl RefUnwindSafe for Relay
impl Send for Relay
impl Sync for Relay
impl Unpin for Relay
impl UnwindSafe for Relay
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