Struct Buffer

Source
pub struct Buffer<M> { /* private fields */ }
Expand description

Stores all received messages in memory

Implementations§

Source§

impl<M> Buffer<M>

Source

pub fn shared_access(&self) -> Arc<RwLock<VecDeque<M>>>

Get shared access to stored messages

Trait Implementations§

Source§

impl<M: Clone + Send + Sync> Codelet for Buffer<M>

Source§

type Status = DefaultStatus

Status code used to indicate health of codelet
Source§

type Config = BufferConfig

Type used for configuration
Source§

type Rx = DoubleBufferRx<M>

Type holding all receiving (RX) endpoints
Source§

type Tx = ()

Type holding all transmitting (TX) endpoints
Source§

type Signals = ()

Type storing the codelet’s signals
Source§

fn build_bundles(_: &Self::Config) -> (Self::Rx, Self::Tx)

Constructs channel bundles
Source§

fn step( &mut self, cx: Context<'_, Self>, rx: &mut Self::Rx, _: &mut Self::Tx, ) -> Outcome

Step is executed periodically after the codelet is started and while it is not paused.
Source§

fn start( &mut self, _cx: Context<'_, Self>, _rx: &mut Self::Rx, _tx: &mut Self::Tx, ) -> Result<Self::Status, Report>

Start is guaranteed to be called first. Start may be called again after stop was called.
Source§

fn stop( &mut self, _cx: Context<'_, Self>, _rx: &mut Self::Rx, _tx: &mut Self::Tx, ) -> Result<Self::Status, Report>

Stop is guaranteed to be called at the end if start was called.
Source§

fn pause(&mut self) -> Result<Self::Status, Report>

Pause may be called to suspend stepping.
Source§

fn resume(&mut self) -> Result<Self::Status, Report>

Resume is called to resume stepping. Note that stop may also be called while the codelet is paused to stop the codelet completely instead of resuming stepping.
Source§

impl<M> Default for Buffer<M>

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<M> Freeze for Buffer<M>

§

impl<M> RefUnwindSafe for Buffer<M>

§

impl<M> Send for Buffer<M>
where M: Send + Sync,

§

impl<M> Sync for Buffer<M>
where M: Send + Sync,

§

impl<M> Unpin for Buffer<M>

§

impl<M> UnwindSafe for Buffer<M>

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<C> Instantiate for C
where C: Codelet + Default,

Source§

fn instantiate<S>(name: S, config: <C as Codelet>::Config) -> CodeletInstance<C>
where S: Into<String>,

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<C> IntoInstance for C
where C: Codelet,

Source§

fn into_instance<S>( self, name: S, config: <C as Codelet>::Config, ) -> CodeletInstance<C>
where S: Into<String>,

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.