[−][src]Struct triple_buffer::Output
Consumer interface to the triple buffer
The consumer of data can use this struct to access the latest published update from the producer whenever he likes. Readout is nonblocking: a collision between the producer and consumer will result in cache contention, but deadlocks and scheduling-induced slowdowns cannot happen.
Methods
impl<T: Send> Output<T>
[src]
pub fn read(&mut self) -> &T
[src]
Access the latest value from the triple buffer
pub fn updated(&self) -> bool
[src]
Tell whether a buffer update is incoming from the producer
This method is only intended for diagnostics purposes. Please do not let it inform your decision of reading a value or not, as that would effectively be building a very poor spinlock-based double buffer implementation. If what you truly need is a double buffer, build yourself a proper blocking one instead of wasting CPU time.
pub fn raw_output_buffer(&mut self) -> &mut T
[src]
Get raw access to the output buffer
This advanced interface allows you to modify the contents of the output buffer, which can in some case improve performance by avoiding to create values of type T when this is an expensive process. One possible application, for example, is to post-process values from the producer.
However, by opting into it, you force yourself to take into account subtle implementation details which you could normally ignore.
First, keep in mind that you can lose access to the current output buffer any time read() or raw_update() is called, as it will be replaced by an updated buffer from the producer automatically.
Second, to reduce the potential for the aforementioned usage error, this method does not update the output buffer automatically. You need to call raw_update() in order to fetch buffer updates from the producer.
To use this method, you have to enable the crate's raw
feature
pub fn raw_update(&mut self) -> bool
[src]
Update the output buffer
Check for incoming updates from the producer, and if so, update our output buffer to the latest data version. This operation will overwrite any changes which you may have commited into the output buffer.
Return a flag telling whether an update was carried out
To use this method, you have to enable the crate's raw
feature
Trait Implementations
Auto Trait Implementations
impl<T> Send for Output<T>
impl<T> Sync for Output<T>
impl<T> Unpin for Output<T>
impl<T> !UnwindSafe for Output<T>
impl<T> !RefUnwindSafe for Output<T>
Blanket Implementations
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,