pub struct MessageTx<T> { /* private fields */ }Expand description
Message transmitter using a double-buffer queue
This is similar to DoubleBufferTx<Message<T>> with the main difference that
push automatically creates a Message.
Implementations§
Source§impl<T> MessageTx<T>
impl<T> MessageTx<T>
Sourcepub fn new(capacity: usize) -> Self
pub fn new(capacity: usize) -> Self
Creates a new transmitter which can publish at most the given number of messages per step.
Sourcepub fn new_auto_size() -> Self
pub fn new_auto_size() -> Self
Creates a new transmitter which can publish an unbounded number of messages per step. Not recommended as it can lead to queues growing without bound.
Sourcepub fn push(&mut self, acqtime: Acqtime, value: T) -> Result<(), TxSendError>
pub fn push(&mut self, acqtime: Acqtime, value: T) -> Result<(), TxSendError>
Adds a Message to the transmitter with given acqtime and value. The message “pubtime” is set to the current time and the message sequence number is automatically incremented. Messages are published after the step functions concludes.
Sourcepub fn push_many<I: IntoIterator<Item = (Acqtime, T)>>(
&mut self,
values: I,
) -> Result<(), TxSendError>
pub fn push_many<I: IntoIterator<Item = (Acqtime, T)>>( &mut self, values: I, ) -> Result<(), TxSendError>
Adds multiple messages to the transmitter (see push).
Trait Implementations§
Source§impl<V: Send + Sync + Clone> TxConnectable for MessageTx<V>
impl<V: Send + Sync + Clone> TxConnectable for MessageTx<V>
Source§fn has_max_connection_count(&self) -> bool
fn has_max_connection_count(&self) -> bool
Returns true if transmitter can connect to more receivers
Source§fn overflow_policy(&self) -> OverflowPolicy
fn overflow_policy(&self) -> OverflowPolicy
Overflow policy of the transmitter
Source§fn on_connect(&mut self, stage: SharedBackStage<Self::Message>)
fn on_connect(&mut self, stage: SharedBackStage<Self::Message>)
Connects the transmitter to a receiver
Auto Trait Implementations§
impl<T> Freeze for MessageTx<T>
impl<T> RefUnwindSafe for MessageTx<T>where
T: RefUnwindSafe,
impl<T> Send for MessageTx<T>
impl<T> Sync for MessageTx<T>
impl<T> Unpin for MessageTx<T>where
T: Unpin,
impl<T> UnwindSafe for MessageTx<T>where
T: UnwindSafe,
Blanket Implementations§
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
Mutably borrows from an owned value. Read more
Source§impl<T> TxBundle for Twhere
T: Tx,
impl<T> TxBundle for Twhere
T: Tx,
Source§fn channel_count(&self) -> usize
fn channel_count(&self) -> usize
Number of channels
Source§fn outbox_message_count(&self, index: usize) -> usize
fn outbox_message_count(&self, index: usize) -> usize
Number of messages currently available on the i-th endpoint
Source§fn flush_all(&mut self, result: &mut [FlushResult])
fn flush_all(&mut self, result: &mut [FlushResult])
Flushes all endpoints
Source§fn check_connection(&self) -> ConnectionCheck
fn check_connection(&self) -> ConnectionCheck
Connection status of all endpoints in the budle
Source§fn iter_names(&self) -> impl Iterator<Item = &str>
fn iter_names(&self) -> impl Iterator<Item = &str>
Iterate over all channel names