Struct zenoh_flow_nodes::prelude::Output
source · pub struct Output<T> { /* private fields */ }Expand description
An Output<T> (only) sends instances of T to downstream nodes.
It’s primary purpose is to enforce type guarantees: only types that implement Into<T> can be sent to downstream
nodes.
Implementations§
source§impl<T: Send + Sync + 'static> Output<T>
impl<T: Send + Sync + 'static> Output<T>
sourcepub async fn send(
&self,
data: impl Into<Data<T>>,
timestamp: Option<u64>
) -> Result<()>
pub async fn send( &self, data: impl Into<Data<T>>, timestamp: Option<u64> ) -> Result<()>
Send, asynchronously, the provided data to downstream node(s).
If no timestamp is provided, the current timestamp (as per the HLC used by the Zenoh-Flow runtime
managing this node) is taken.
§Synchronous alternative: try_send
This method is an asynchronous alternative to its fail-fast synchronous counterpart try_send.
§Errors
An error is returned if the send operation failed.
sourcepub fn try_send(
&self,
data: impl Into<Data<T>>,
timestamp: Option<u64>
) -> Result<()>
pub fn try_send( &self, data: impl Into<Data<T>>, timestamp: Option<u64> ) -> Result<()>
Send, synchronously, the provided data to downstream node(s).
If no timestamp is provided, the current timestamp (as per the HLC used by the Zenoh-Flow runtime
running this node) is taken.
§Asynchronous alternative: send
This method is a fail-fast synchronous alternative to its asynchronous counterpart send.
§Errors
An error is returned if sending on a channel failed.
Methods from Deref<Target = OutputRaw>§
sourcepub fn channels_count(&self) -> usize
pub fn channels_count(&self) -> usize
Returns the number of channels associated with this Output.
sourcepub fn try_send(
&self,
payload: impl Into<Payload>,
timestamp: Option<u64>
) -> Result<()>
pub fn try_send( &self, payload: impl Into<Payload>, timestamp: Option<u64> ) -> Result<()>
Attempt to send, synchronously, the data on all channels to the downstream Nodes.
If no timestamp is provided, the current timestamp (as per the HLC used by
the Zenoh-Flow daemon running this Node) is taken.
§Asynchronous alternative: send
This method is a synchronous fail-fast alternative to its asynchronous counterpart: send.
Hence, although synchronous, this method will not block the thread on which it is executed.
§Errors
If an error occurs while sending the watermark on a channel, Zenoh-Flow still tries to send it on the remaining channels. For each failing channel, an error is logged and counted for.
sourcepub async fn forward(&self, message: LinkMessage) -> Result<()>
pub async fn forward(&self, message: LinkMessage) -> Result<()>
Forward, asynchronously, the LinkMessage on all channels to the downstream Nodes.
§Errors
If an error occurs while sending the message on a channel, Zenoh-Flow still tries to send it on the remaining channels. For each failing channel, an error is logged and counted for.
sourcepub async fn send(
&self,
payload: impl Into<Payload>,
timestamp: Option<u64>
) -> Result<()>
pub async fn send( &self, payload: impl Into<Payload>, timestamp: Option<u64> ) -> Result<()>
Send, asynchronously, the data on all channels to the downstream Nodes.
If no timestamp is provided, the current timestamp — as per the HLC used by
the Zenoh-Flow daemon running this Node — is taken.
§Errors
If an error occurs while sending the watermark on a channel, Zenoh-Flow still tries to send it on the remaining channels. For each failing channel, an error is logged and counted for.