#[non_exhaustive]pub enum ObserverMode {
Never,
Always,
Every(u64),
}Expand description
Per-registration policy for observe_iter.
Never and Every gate the iteration callback only — observe_init and
observe_final always fire. A user who wants to fully disable an observer
should simply not register it.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Never
Skip observe_iter entirely. The observer
still sees observe_init / observe_final.
Always
Fire observe_iter on every iteration.
Every(u64)
Fire observe_iter on iterations whose
(post-increment) counter is a multiple of n. Every(1) is
equivalent to Always; Every(0) is rejected as
nonsensical and panics on construction via
every, but raw construction is permitted and
treated as Never (no iter is a multiple of zero under the
iter % n == 0 rule because n == 0 would divide-by-zero — the
executor checks for n != 0 before the modulus).
Implementations§
Trait Implementations§
Source§impl Clone for ObserverMode
impl Clone for ObserverMode
Source§fn clone(&self) -> ObserverMode
fn clone(&self) -> ObserverMode
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ObserverMode
Source§impl Debug for ObserverMode
impl Debug for ObserverMode
impl Eq for ObserverMode
Source§impl PartialEq for ObserverMode
impl PartialEq for ObserverMode
Source§fn eq(&self, other: &ObserverMode) -> bool
fn eq(&self, other: &ObserverMode) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for ObserverMode
Auto Trait Implementations§
impl Freeze for ObserverMode
impl RefUnwindSafe for ObserverMode
impl Send for ObserverMode
impl Sync for ObserverMode
impl Unpin for ObserverMode
impl UnsafeUnpin for ObserverMode
impl UnwindSafe for ObserverMode
Blanket Implementations§
impl<T> Boilerplate for T
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T, U> Imply<T> for U
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> Pointable for T
impl<T> Pointable for T
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.