Struct tor_cell::chancell::msg::Relay

source ·
pub struct Relay { /* private fields */ }
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.

Implementations§

source§

impl Relay

source

pub fn new<P>(body: P) -> Selfwhere P: AsRef<[u8]>,

Construct a Relay message from a slice containing its contents.

source

pub fn from_raw(body: RawCellBody) -> Self

Construct a Relay message from its body.

source

pub fn into_relay_body(self) -> BoxedCellBody

Consume this Relay message and return a BoxedCellBody for encryption/decryption.

source

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

source§

fn encode_onto<W: Writer + ?Sized>(self, w: &mut W) -> EncodeResult<()>

Consume this message and encode its body onto w. Read more
source§

fn decode_from_reader(r: &mut Reader<'_>) -> Result<Self>

Decode a channel cell body from a provided reader.
source§

impl ChanMsg for Relay

source§

fn cmd(&self) -> ChanCmd

Return the ChanCmd for this message.
source§

fn encode_onto<W: Writer + ?Sized>(self, w: &mut W) -> EncodeResult<()>

Write the body of this message (not including length or command).
source§

fn decode_from_reader(cmd: ChanCmd, r: &mut Reader<'_>) -> Result<Self>

Decode this message from a given reader, according to a specified command value. The reader must be truncated to the exact length of the body.
source§

impl Clone for Relay

source§

fn clone(&self) -> Relay

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for Relay

source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl From<Box<[u8; 509], Global>> for Relay

source§

fn from(original: BoxedCellBody) -> Relay

Converts to this type from the input type.
source§

impl From<Relay> for AnyChanMsg

source§

fn from(m: Relay) -> AnyChanMsg

Converts to this type from the input type.
source§

impl From<Relay> for RelayEarly

source§

fn from(original: Relay) -> RelayEarly

Converts to this type from the input type.
source§

impl From<RelayEarly> for Relay

source§

fn from(original: RelayEarly) -> Self

Converts to this type from the input type.
source§

impl Readable for Relay

source§

fn take_from(r: &mut Reader<'_>) -> Result<Self>

Try to extract an object of this type from a Reader. Read more

Auto Trait Implementations§

§

impl RefUnwindSafe for Relay

§

impl Send for Relay

§

impl Sync for Relay

§

impl Unpin for Relay

§

impl UnwindSafe for Relay

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more