MessageTx

Struct MessageTx 

Source
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>

Source

pub fn new(capacity: usize) -> Self

Creates a new transmitter which can publish at most the given number of messages per step.

Source

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.

Source

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.

Source

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<T: Send + Sync + Clone> Tx for MessageTx<T>

Source§

fn flush(&mut self) -> FlushResult

Finalizes sending of messages
Source§

fn is_connected(&self) -> bool

Returns true if the channel is connected
Source§

fn len(&self) -> usize

Number of messages currently in the outbox
Source§

impl<V: Send + Sync + Clone> TxConnectable for MessageTx<V>

Source§

type Message = Message<V>

Type of message this endpoint transmits
Source§

fn has_max_connection_count(&self) -> bool

Returns true if transmitter can connect to more receivers
Source§

fn overflow_policy(&self) -> OverflowPolicy

Overflow policy of the transmitter
Source§

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>
where T: Send + Sync,

§

impl<T> Sync for MessageTx<T>
where T: Sync + Send,

§

impl<T> Unpin for MessageTx<T>
where T: Unpin,

§

impl<T> UnwindSafe for MessageTx<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where 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, U> Into<U> for T
where 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

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 T
where U: TryFrom<T>,

Source§

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.
Source§

impl<T> TxBundle for T
where T: Tx,

Source§

fn channel_count(&self) -> usize

Number of channels
Source§

fn name(&self, index: usize) -> &str

Name of the i-th endpoint
Source§

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])

Flushes all endpoints
Source§

fn check_connection(&self) -> ConnectionCheck

Connection status of all endpoints in the budle
Source§

fn iter_names(&self) -> impl Iterator<Item = &str>

Iterate over all channel names
Source§

impl<V, T> TxMessageEndpoint<V> for T
where T: TxConnectable<Message = Message<V>>,