pub struct Routed<M>where
M: Message,{ /* private fields */ }
Expand description
A message wrapper that provides message route information.
Workers can accept arbitrary message types, which may not contain information about their routes.
However, the Ockam worker and messaging system already keeps track of this information internally.
This type makes it possible to expose this information to the user, without requiring changes to the user’s message types.
Examples
See ockam_node::WorkerRelay
for a usage example.
Implementations
sourceimpl<M> Routed<M>where
M: Message,
impl<M> Routed<M>where
M: Message,
sourcepub fn new(inner: M, msg_addr: Address, local_msg: LocalMessage) -> Routed<M>
pub fn new(inner: M, msg_addr: Address, local_msg: LocalMessage) -> Routed<M>
Create a new Routed
message wrapper from the given message,
message address and a local message that contains routing
information.
sourcepub fn onward_route(&self) -> Route
pub fn onward_route(&self) -> Route
Return a copy of the onward route for the wrapped message.
sourcepub fn return_route(&self) -> Route
pub fn return_route(&self) -> Route
Return a copy of the full return route for the wrapped message.
sourcepub fn into_local_message(self) -> LocalMessage
pub fn into_local_message(self) -> LocalMessage
Consume the message wrapper and return the underlying local message.
sourcepub fn into_transport_message(self) -> TransportMessage
pub fn into_transport_message(self) -> TransportMessage
Consume the message wrapper and return the underlying transport message.
sourcepub fn local_message(&self) -> &LocalMessage
pub fn local_message(&self) -> &LocalMessage
Return a reference to the underlying local message.
Trait Implementations
Auto Trait Implementations
impl<M> RefUnwindSafe for Routed<M>where
M: RefUnwindSafe,
impl<M> Send for Routed<M>
impl<M> Sync for Routed<M>where
M: Sync,
impl<M> Unpin for Routed<M>where
M: Unpin,
impl<M> UnwindSafe for Routed<M>where
M: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T>where
T: Future, type Output = <T as Future>::Output;
fn instrument(self, span: Span) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T>where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
sourcefn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T>where
T: Future, type Output = <T as Future>::Output;
fn in_current_span(self) -> Instrumented<Self>ⓘNotable traits for Instrumented<T>impl<T> Future for Instrumented<T>where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
impl<V, T> VZip<V> for Twhere
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T>where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T>where
T: Future, type Output = <T as Future>::Output;
where
S: Into<Dispatch>,
T: Future, type Output = <T as Future>::Output;
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T>where
T: Future, type Output = <T as Future>::Output;
fn with_current_subscriber(self) -> WithDispatch<Self>ⓘNotable traits for WithDispatch<T>impl<T> Future for WithDispatch<T>where
T: Future, type Output = <T as Future>::Output;
T: Future, type Output = <T as Future>::Output;
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more