Skip to main content

Producer

Struct Producer 

Source
pub struct Producer<'a, T: Copy> { /* private fields */ }
Expand description

Unique, stateless write handle for a LatestBuf.

This handle is Send when T: Send (the handle can move a payload across contexts, so a non-Send payload correctly pins it — T: Copy alone does not imply T: Send) and always !Sync: it may move into an ISR or another execution context, but it may not be shared between contexts. Sole-producer ownership is load-bearing for the exclusive-slot soundness argument (contract H2).

use ph_eventing::latest_buf::Producer;

fn assert_sync<T: Sync>() {}
assert_sync::<Producer<'static, u32>>();

Implementations§

Source§

impl<T: Copy> Producer<'_, T>

Source

pub fn publish(&self, value: T) -> PublishReport

Publish a complete value as the newest channel state.

This always succeeds, executes one payload write and one atomic swap, and never waits for consumer progress.

Trait Implementations§

Source§

impl<T: Copy> Debug for Producer<'_, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T: Copy> Drop for Producer<'_, T>

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

fn pin_drop(self: Pin<&mut Self>)

🔬This is a nightly-only experimental API. (pin_ergonomics)
Execute the destructor for this type, but different to Drop::drop, it requires self to be pinned. Read more
Source§

impl<T: Copy> LatestSink<T> for Producer<'_, T>

Source§

fn publish_latest(&mut self, value: T) -> PublishReport

Publish value and report its generation and any replacement.

Auto Trait Implementations§

§

impl<'a, T> !RefUnwindSafe for Producer<'a, T>

§

impl<'a, T> !Sync for Producer<'a, T>

§

impl<'a, T> !UnwindSafe for Producer<'a, T>

§

impl<'a, T> Freeze for Producer<'a, T>

§

impl<'a, T> Send for Producer<'a, T>
where T: Send,

§

impl<'a, T> Unpin for Producer<'a, T>

§

impl<'a, T> UnsafeUnpin for Producer<'a, T>

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.