pub trait GetUpdate {
type G;
type U;
// Required methods
fn get(&mut self) -> Option<Self::G>;
fn update(&mut self, u: Self::U) -> Unblocked;
// Provided method
fn update_multiples(
&mut self,
us: impl IntoIterator<Item = Self::U>,
) -> Unblocked { ... }
}Expand description
Where your shared state logic should be implemented
GetUpdate represents the shared state of your logic.
§In progress
This trait can mostly be approached from a sequential (ie. not multi-thread)
point of view, except for one thing: one can now observe unit of work being
in progress. Or rather, one can call get and get a unit of work to process
while another thread is still processing a previous unit of work returned by
get. In some cases, your state should represent units of work being processed
but not finished yet for your application logic to be correct.
Required Associated Types§
Sourcetype G
type G
The return type of GetUpdate::get
Sourcetype U
type U
The argument type of GetUpdate::update and GetUpdate::update_multiples
Required Methods§
Provided Methods§
Sourcefn update_multiples(
&mut self,
us: impl IntoIterator<Item = Self::U>,
) -> Unblocked
fn update_multiples( &mut self, us: impl IntoIterator<Item = Self::U>, ) -> Unblocked
Updated the state with several updates, returning an upper bound of how many new units of works were made available by all these update.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.