#[repr(transparent)]pub struct State<Q = usize>(pub Q)
where
    Q: ?Sized;Tuple Fields§
§0: QImplementations§
Source§impl<Q> State<Q>where
    Q: RawState,
generic implementation of the State type available for all types Q
 
impl<Q> State<Q>where
    Q: RawState,
generic implementation of the State type available for all types Q
Sourcepub fn new_with<F>(f: F) -> State<Q>where
    F: FnOnce() -> Q,
 
pub fn new_with<F>(f: F) -> State<Q>where
    F: FnOnce() -> Q,
returns a new instance of State using the output of the given function F
Sourcepub fn default() -> State<Q>where
    Q: Default,
 
pub fn default() -> State<Q>where
    Q: Default,
returns a new instance of State using the logical default for the type Q
Sourcepub fn zero() -> State<Q>where
    Q: Zero,
 
pub fn zero() -> State<Q>where
    Q: Zero,
returns a new instance of State with an inner value of 0
Sourcepub fn random() -> State<Q>where
    StandardUniform: Distribution<Q>,
 
pub fn random() -> State<Q>where
    StandardUniform: Distribution<Q>,
generate a new instance of the state with a random value
pub fn random_with<R, Dist>(rng: &mut R, distr: Dist) -> State<Q>where
    Dist: Distribution<Q>,
    R: RngCore,
Sourcepub const fn replace(&mut self, state: Q) -> Q
 
pub const fn replace(&mut self, state: Q) -> Q
replace the inner state with the given value and return the
previous
Sourcepub fn set(&mut self, state: Q)
 
pub fn set(&mut self, state: Q)
mutate the inner value in-place, updating it with the given state
Sourcepub const fn swap(&mut self, state: &mut State<Q>)
 
pub const fn swap(&mut self, state: &mut State<Q>)
swap the inner value with that of another state instance of the
same type Q
Sourcepub fn take(&mut self) -> Qwhere
    Q: Default,
 
pub fn take(&mut self) -> Qwhere
    Q: Default,
takes the inner value and replaces it with the default value
Sourcepub fn with<U>(self, value: U) -> State<U>
 
pub fn with<U>(self, value: U) -> State<U>
consumes the current instance to replace it with another.
Sourcepub fn map<U, F>(self, f: F) -> State<U>where
    F: FnOnce(Q) -> U,
 
pub fn map<U, F>(self, f: F) -> State<U>where
    F: FnOnce(Q) -> U,
apply a function onto the inner value and return a new instance with the result
Sourcepub fn map_inplace<F>(&mut self, f: F) -> &mut State<Q>
 
pub fn map_inplace<F>(&mut self, f: F) -> &mut State<Q>
updates the inner value using the given function and returns a mutable reference to the current instance for chaining
Source§impl<Q> State<MaybeUninit<Q>>where
    Q: RawState,
 
impl<Q> State<MaybeUninit<Q>>where
    Q: RawState,
Sourcepub fn uninit() -> State<MaybeUninit<Q>>
 
pub fn uninit() -> State<MaybeUninit<Q>>
returns a new state with an uninitialized inner state
Sourcepub fn init(value: Q) -> State<MaybeUninit<Q>>
 
pub fn init(value: Q) -> State<MaybeUninit<Q>>
returns a new state with an initialized inner state
Trait Implementations§
Source§impl<'a, _A, _B, _C> Add<&'a mut State<_B>> for State<_A>where
    _A: Add<&'a mut _B, Output = _C>,
 
impl<'a, _A, _B, _C> Add<&'a mut State<_B>> for State<_A>where
    _A: Add<&'a mut _B, Output = _C>,
Source§impl<'a, _A, _B, _C> Add<State<_B>> for &'a mut State<_A>where
    &'a mut _A: Add<_B, Output = _C>,
 
impl<'a, _A, _B, _C> Add<State<_B>> for &'a mut State<_A>where
    &'a mut _A: Add<_B, Output = _C>,
Source§impl<_A, _B> AddAssign<State<_B>> for State<_A>where
    _A: AddAssign<_B>,
 
impl<_A, _B> AddAssign<State<_B>> for State<_A>where
    _A: AddAssign<_B>,
Source§fn add_assign(&mut self, rhs: State<_B>)
 
fn add_assign(&mut self, rhs: State<_B>)
+= operation. Read moreSource§impl<'a, _A, _B, _C> BitAnd<&'a mut State<_B>> for State<_A>where
    _A: BitAnd<&'a mut _B, Output = _C>,
 
impl<'a, _A, _B, _C> BitAnd<&'a mut State<_B>> for State<_A>where
    _A: BitAnd<&'a mut _B, Output = _C>,
Source§impl<'a, _A, _B, _C> BitAnd<State<_B>> for &'a mut State<_A>where
    &'a mut _A: BitAnd<_B, Output = _C>,
 
impl<'a, _A, _B, _C> BitAnd<State<_B>> for &'a mut State<_A>where
    &'a mut _A: BitAnd<_B, Output = _C>,
Source§impl<_A, _B> BitAndAssign<State<_B>> for State<_A>where
    _A: BitAndAssign<_B>,
 
impl<_A, _B> BitAndAssign<State<_B>> for State<_A>where
    _A: BitAndAssign<_B>,
Source§fn bitand_assign(&mut self, rhs: State<_B>)
 
fn bitand_assign(&mut self, rhs: State<_B>)
&= operation. Read moreSource§impl<'a, _A, _B, _C> BitOr<&'a mut State<_B>> for State<_A>where
    _A: BitOr<&'a mut _B, Output = _C>,
 
impl<'a, _A, _B, _C> BitOr<&'a mut State<_B>> for State<_A>where
    _A: BitOr<&'a mut _B, Output = _C>,
Source§impl<'a, _A, _B, _C> BitOr<State<_B>> for &'a mut State<_A>where
    &'a mut _A: BitOr<_B, Output = _C>,
 
impl<'a, _A, _B, _C> BitOr<State<_B>> for &'a mut State<_A>where
    &'a mut _A: BitOr<_B, Output = _C>,
Source§impl<_A, _B> BitOrAssign<State<_B>> for State<_A>where
    _A: BitOrAssign<_B>,
 
impl<_A, _B> BitOrAssign<State<_B>> for State<_A>where
    _A: BitOrAssign<_B>,
Source§fn bitor_assign(&mut self, rhs: State<_B>)
 
fn bitor_assign(&mut self, rhs: State<_B>)
|= operation. Read moreSource§impl<'a, _A, _B, _C> BitXor<&'a mut State<_B>> for State<_A>where
    _A: BitXor<&'a mut _B, Output = _C>,
 
impl<'a, _A, _B, _C> BitXor<&'a mut State<_B>> for State<_A>where
    _A: BitXor<&'a mut _B, Output = _C>,
Source§impl<'a, _A, _B, _C> BitXor<State<_B>> for &'a mut State<_A>where
    &'a mut _A: BitXor<_B, Output = _C>,
 
impl<'a, _A, _B, _C> BitXor<State<_B>> for &'a mut State<_A>where
    &'a mut _A: BitXor<_B, Output = _C>,
Source§impl<_A, _B> BitXorAssign<State<_B>> for State<_A>where
    _A: BitXorAssign<_B>,
 
impl<_A, _B> BitXorAssign<State<_B>> for State<_A>where
    _A: BitXorAssign<_B>,
Source§fn bitxor_assign(&mut self, rhs: State<_B>)
 
fn bitxor_assign(&mut self, rhs: State<_B>)
^= operation. Read moreSource§impl<Q> BorrowMut<Q> for State<Q>where
    Q: RawState,
 
impl<Q> BorrowMut<Q> for State<Q>where
    Q: RawState,
Source§fn borrow_mut(&mut self) -> &mut Q
 
fn borrow_mut(&mut self) -> &mut Q
Source§impl<'de, Q> Deserialize<'de> for State<Q>
 
impl<'de, Q> Deserialize<'de> for State<Q>
Source§fn deserialize<__D>(
    __deserializer: __D,
) -> Result<State<Q>, <__D as Deserializer<'de>>::Error>where
    __D: Deserializer<'de>,
 
fn deserialize<__D>(
    __deserializer: __D,
) -> Result<State<Q>, <__D as Deserializer<'de>>::Error>where
    __D: Deserializer<'de>,
Source§impl<'a, _A, _B, _C> Div<&'a mut State<_B>> for State<_A>where
    _A: Div<&'a mut _B, Output = _C>,
 
impl<'a, _A, _B, _C> Div<&'a mut State<_B>> for State<_A>where
    _A: Div<&'a mut _B, Output = _C>,
Source§impl<'a, _A, _B, _C> Div<State<_B>> for &'a mut State<_A>where
    &'a mut _A: Div<_B, Output = _C>,
 
impl<'a, _A, _B, _C> Div<State<_B>> for &'a mut State<_A>where
    &'a mut _A: Div<_B, Output = _C>,
Source§impl<_A, _B> DivAssign<State<_B>> for State<_A>where
    _A: DivAssign<_B>,
 
impl<_A, _B> DivAssign<State<_B>> for State<_A>where
    _A: DivAssign<_B>,
Source§fn div_assign(&mut self, rhs: State<_B>)
 
fn div_assign(&mut self, rhs: State<_B>)
/= operation. Read moreSource§impl<'a, _A, _B, _C> Mul<&'a mut State<_B>> for State<_A>where
    _A: Mul<&'a mut _B, Output = _C>,
 
impl<'a, _A, _B, _C> Mul<&'a mut State<_B>> for State<_A>where
    _A: Mul<&'a mut _B, Output = _C>,
Source§impl<'a, _A, _B, _C> Mul<State<_B>> for &'a mut State<_A>where
    &'a mut _A: Mul<_B, Output = _C>,
 
impl<'a, _A, _B, _C> Mul<State<_B>> for &'a mut State<_A>where
    &'a mut _A: Mul<_B, Output = _C>,
Source§impl<_A, _B> MulAssign<State<_B>> for State<_A>where
    _A: MulAssign<_B>,
 
impl<_A, _B> MulAssign<State<_B>> for State<_A>where
    _A: MulAssign<_B>,
Source§fn mul_assign(&mut self, rhs: State<_B>)
 
fn mul_assign(&mut self, rhs: State<_B>)
*= operation. Read moreSource§impl<Q> Num for State<Q>
 
impl<Q> Num for State<Q>
type FromStrRadixErr = <Q as Num>::FromStrRadixErr
Source§impl<Q> Ord for State<Q>
 
impl<Q> Ord for State<Q>
Source§impl<Q> PartialOrd<Q> for State<Q>where
    Q: RawState + PartialOrd,
 
impl<Q> PartialOrd<Q> for State<Q>where
    Q: RawState + PartialOrd,
Source§impl<Q> PartialOrd for State<Q>where
    Q: PartialOrd + ?Sized,
 
impl<Q> PartialOrd for State<Q>where
    Q: PartialOrd + ?Sized,
Source§impl<'a, _A, _B, _C> Rem<&'a mut State<_B>> for State<_A>where
    _A: Rem<&'a mut _B, Output = _C>,
 
impl<'a, _A, _B, _C> Rem<&'a mut State<_B>> for State<_A>where
    _A: Rem<&'a mut _B, Output = _C>,
Source§impl<'a, _A, _B, _C> Rem<State<_B>> for &'a mut State<_A>where
    &'a mut _A: Rem<_B, Output = _C>,
 
impl<'a, _A, _B, _C> Rem<State<_B>> for &'a mut State<_A>where
    &'a mut _A: Rem<_B, Output = _C>,
Source§impl<_A, _B> RemAssign<State<_B>> for State<_A>where
    _A: RemAssign<_B>,
 
impl<_A, _B> RemAssign<State<_B>> for State<_A>where
    _A: RemAssign<_B>,
Source§fn rem_assign(&mut self, rhs: State<_B>)
 
fn rem_assign(&mut self, rhs: State<_B>)
%= operation. Read moreSource§impl<Q> Serialize for State<Q>
 
impl<Q> Serialize for State<Q>
Source§fn serialize<__S>(
    &self,
    __serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
    __S: Serializer,
 
fn serialize<__S>(
    &self,
    __serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
    __S: Serializer,
Source§impl<'a, _A, _B, _C> Shl<&'a mut State<_B>> for State<_A>where
    _A: Shl<&'a mut _B, Output = _C>,
 
impl<'a, _A, _B, _C> Shl<&'a mut State<_B>> for State<_A>where
    _A: Shl<&'a mut _B, Output = _C>,
Source§impl<'a, _A, _B, _C> Shl<State<_B>> for &'a mut State<_A>where
    &'a mut _A: Shl<_B, Output = _C>,
 
impl<'a, _A, _B, _C> Shl<State<_B>> for &'a mut State<_A>where
    &'a mut _A: Shl<_B, Output = _C>,
Source§impl<_A, _B> ShlAssign<State<_B>> for State<_A>where
    _A: ShlAssign<_B>,
 
impl<_A, _B> ShlAssign<State<_B>> for State<_A>where
    _A: ShlAssign<_B>,
Source§fn shl_assign(&mut self, rhs: State<_B>)
 
fn shl_assign(&mut self, rhs: State<_B>)
<<= operation. Read moreSource§impl<'a, _A, _B, _C> Shr<&'a mut State<_B>> for State<_A>where
    _A: Shr<&'a mut _B, Output = _C>,
 
impl<'a, _A, _B, _C> Shr<&'a mut State<_B>> for State<_A>where
    _A: Shr<&'a mut _B, Output = _C>,
Source§impl<'a, _A, _B, _C> Shr<State<_B>> for &'a mut State<_A>where
    &'a mut _A: Shr<_B, Output = _C>,
 
impl<'a, _A, _B, _C> Shr<State<_B>> for &'a mut State<_A>where
    &'a mut _A: Shr<_B, Output = _C>,
Source§impl<_A, _B> ShrAssign<State<_B>> for State<_A>where
    _A: ShrAssign<_B>,
 
impl<_A, _B> ShrAssign<State<_B>> for State<_A>where
    _A: ShrAssign<_B>,
Source§fn shr_assign(&mut self, rhs: State<_B>)
 
fn shr_assign(&mut self, rhs: State<_B>)
>>= operation. Read moreSource§impl<'a, _A, _B, _C> Sub<&'a mut State<_B>> for State<_A>where
    _A: Sub<&'a mut _B, Output = _C>,
 
impl<'a, _A, _B, _C> Sub<&'a mut State<_B>> for State<_A>where
    _A: Sub<&'a mut _B, Output = _C>,
Source§impl<'a, _A, _B, _C> Sub<State<_B>> for &'a mut State<_A>where
    &'a mut _A: Sub<_B, Output = _C>,
 
impl<'a, _A, _B, _C> Sub<State<_B>> for &'a mut State<_A>where
    &'a mut _A: Sub<_B, Output = _C>,
Source§impl<_A, _B> SubAssign<State<_B>> for State<_A>where
    _A: SubAssign<_B>,
 
impl<_A, _B> SubAssign<State<_B>> for State<_A>where
    _A: SubAssign<_B>,
Source§fn sub_assign(&mut self, rhs: State<_B>)
 
fn sub_assign(&mut self, rhs: State<_B>)
-= operation. Read moreimpl<Q> Copy for State<Q>
impl<Q> Eq for State<Q>
impl<Q> StructuralPartialEq for State<Q>where
    Q: ?Sized,
Auto Trait Implementations§
impl<Q> Freeze for State<Q>
impl<Q> RefUnwindSafe for State<Q>where
    Q: RefUnwindSafe + ?Sized,
impl<Q> Send for State<Q>
impl<Q> Sync for State<Q>
impl<Q> Unpin for State<Q>
impl<Q> UnwindSafe for State<Q>where
    Q: UnwindSafe + ?Sized,
Blanket Implementations§
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
Source§impl<T> CloneToUninit for Twhere
    T: Clone,
 
impl<T> CloneToUninit for Twhere
    T: Clone,
Source§impl<K, S> Identity<K> for Swhere
    S: Borrow<K>,
    K: Identifier,
 
impl<K, S> Identity<K> for Swhere
    S: Borrow<K>,
    K: Identifier,
Source§impl<R> Rng for R
 
impl<R> Rng for R
Source§fn random<T>(&mut self) -> Twhere
    StandardUniform: Distribution<T>,
 
fn random<T>(&mut self) -> Twhere
    StandardUniform: Distribution<T>,
StandardUniform distribution. Read moreSource§fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
 
fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
Source§fn random_range<T, R>(&mut self, range: R) -> Twhere
    T: SampleUniform,
    R: SampleRange<T>,
 
fn random_range<T, R>(&mut self, range: R) -> Twhere
    T: SampleUniform,
    R: SampleRange<T>,
Source§fn random_bool(&mut self, p: f64) -> bool
 
fn random_bool(&mut self, p: f64) -> bool
p of being true. Read moreSource§fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
 
fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
numerator/denominator of being
true. Read moreSource§fn sample<T, D>(&mut self, distr: D) -> Twhere
    D: Distribution<T>,
 
fn sample<T, D>(&mut self, distr: D) -> Twhere
    D: Distribution<T>,
Source§fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>where
    D: Distribution<T>,
    Self: Sized,
 
fn sample_iter<T, D>(self, distr: D) -> Iter<D, Self, T>where
    D: Distribution<T>,
    Self: Sized,
Source§fn gen<T>(&mut self) -> Twhere
    StandardUniform: Distribution<T>,
 
fn gen<T>(&mut self) -> Twhere
    StandardUniform: Distribution<T>,
random to avoid conflict with the new gen keyword in Rust 2024.Rng::random.Source§fn gen_range<T, R>(&mut self, range: R) -> Twhere
    T: SampleUniform,
    R: SampleRange<T>,
 
fn gen_range<T, R>(&mut self, range: R) -> Twhere
    T: SampleUniform,
    R: SampleRange<T>,
random_rangeRng::random_range.Source§impl<R> TryRngCore for R
 
impl<R> TryRngCore for R
Source§type Error = Infallible
 
type Error = Infallible
Source§fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
 
fn try_next_u32(&mut self) -> Result<u32, <R as TryRngCore>::Error>
u32.Source§fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
 
fn try_next_u64(&mut self) -> Result<u64, <R as TryRngCore>::Error>
u64.Source§fn try_fill_bytes(
    &mut self,
    dst: &mut [u8],
) -> Result<(), <R as TryRngCore>::Error>
 
fn try_fill_bytes( &mut self, dst: &mut [u8], ) -> Result<(), <R as TryRngCore>::Error>
dest entirely with random data.Source§fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
 
fn unwrap_mut(&mut self) -> UnwrapMut<'_, Self>
UnwrapMut wrapper.Source§fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>where
    Self: Sized,
 
fn read_adapter(&mut self) -> RngReadAdapter<'_, Self>where
    Self: Sized,
RngCore to a RngReadAdapter.