pub struct WithChannels<I: Channels<S>, S: Service> {
pub inner: I,
pub tx: <I as Channels<S>>::Tx,
pub rx: <I as Channels<S>>::Rx,
pub span: Span,
}Expand description
A wrapper for a message with channels to send and receive it. This expands the protocol message to a full message that includes the active and unserializable channels.
The channel kind for rx and tx is defined by implementing the Channels
trait, either manually or using a macro.
When the spans feature is enabled, this also includes a tracing
span to carry the tracing context during message passing.
Fields§
§inner: IThe inner message.
tx: <I as Channels<S>>::TxThe return channel to send the response to. Can be set to crate::channel::none::NoSender if not needed.
rx: <I as Channels<S>>::RxThe request channel to receive the request from. Can be set to NoReceiver if not needed.
span: Spanspans only.The current span where the full message was created.
Implementations§
Source§impl<I: Channels<S>, S: Service> WithChannels<I, S>
impl<I: Channels<S>, S: Service> WithChannels<I, S>
Sourcepub fn parent_span_opt(&self) -> Option<&Span>
Available on crate feature spans only.
pub fn parent_span_opt(&self) -> Option<&Span>
spans only.Get the parent span
Trait Implementations§
Source§impl<I: Channels<S>, S: Service> Deref for WithChannels<I, S>
Deref so you can access the inner fields directly.
impl<I: Channels<S>, S: Service> Deref for WithChannels<I, S>
Deref so you can access the inner fields directly.
If the inner message has fields named tx, rx or span, you need to use the
inner field to access them.
Source§impl<I, S> From<(I,)> for WithChannels<I, S>
Tuple conversion from inner message to a WithChannels struct without channels
impl<I, S> From<(I,)> for WithChannels<I, S>
Tuple conversion from inner message to a WithChannels struct without channels
Source§impl<I, S, Tx> From<(I, Tx)> for WithChannels<I, S>
Tuple conversion from inner message and tx channel to a WithChannels struct
impl<I, S, Tx> From<(I, Tx)> for WithChannels<I, S>
Tuple conversion from inner message and tx channel to a WithChannels struct
For the very common case where you just need a tx channel to send the response to.
Source§impl<I, S: Service, Tx, Rx> From<(I, Tx, Rx)> for WithChannels<I, S>
Tuple conversion from inner message and tx/rx channels to a WithChannels struct
impl<I, S: Service, Tx, Rx> From<(I, Tx, Rx)> for WithChannels<I, S>
Tuple conversion from inner message and tx/rx channels to a WithChannels struct
For the case where you want both tx and rx channels.