pub struct TcReader<T, M>where
T: TakesMessage<M>,{ /* private fields */ }Expand description
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.
Implementations§
Source§impl<T, M> TcReader<T, M>
impl<T, M> TcReader<T, M>
Sourcepub fn update(&mut self) -> usize
pub fn update(&mut self) -> usize
Receives all waiting messages and applies them to the local object.
Sourcepub fn update_return(&mut self) -> Vec<M>
pub fn update_return(&mut self) -> Vec<M>
Receives any waiting messages up to a limit. collects and returns these messages in a vector.
Sourcepub fn update_limited(&mut self, limit: usize) -> usize
pub fn update_limited(&mut self, limit: usize) -> usize
Receives any waiting messages up to a limit. Returns number of messages received and applied.
Sourcepub fn update_return_limited(&mut self, limit: usize) -> Vec<M>
pub fn update_return_limited(&mut self, limit: usize) -> Vec<M>
combination of update_return and update_limited
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consumes the reader, returning the current version of the trailing T.