Struct trailing_cell::TcReader
[−]
[src]
pub struct TcReader<T, M> where
T: TakesMessage<M>, { /* fields omitted */ }
TcReader<T,M>
maintains its local T
object. The reader will receive and
apply incoming M
messages to its T whenever explicitly invoked by
update
, update_limited
or implicity by get_mut_fresh
.
Access to the local copy is granted through the two get_mut
variants.
Without any messages, this local access is very fast. The reader can also be
consumed to unwrap the local T
.
The very explicit convention of using stale
and fresh
everywhere is to
make unintentionally forgetting a crucial update less likely.
Methods
impl<T, M> TcReader<T, M> where
T: TakesMessage<M>,
M: Sync + Clone,
[src]
T: TakesMessage<M>,
M: Sync + Clone,
fn update(&mut self) -> usize
[src]
Receives all waiting messages and applies them to the local object.
fn update_return(&mut self) -> Vec<M>
[src]
Receives any waiting messages up to a limit. collects and returns these messages in a vector.
fn update_limited(&mut self, limit: usize) -> usize
[src]
Receives any waiting messages up to a limit. Returns number of messages received and applied.
fn update_return_limited(&mut self, limit: usize) -> Vec<M>
[src]
combination of update_return
and update_limited
fn into_inner(self) -> T
[src]
Consumes the reader, returning the current version of the trailing T
.
Trait Implementations
impl<T, M> Deref for TcReader<T, M> where
T: TakesMessage<M>,
[src]
T: TakesMessage<M>,
type Target = T
The resulting type after dereferencing.
fn deref(&self) -> &T
[src]
Dereferences the value.
impl<T, M> DerefMut for TcReader<T, M> where
T: TakesMessage<M>,
[src]
T: TakesMessage<M>,