pub struct MutProxy<'a, T, W, E, B>{ /* private fields */ }Expand description
A proxy object for mutable access to an element within a FixedVec.
This struct is returned by FixedVec::at_mut. It holds a temporary copy
of an element’s value. When the proxy is dropped, its Drop implementation
writes the (potentially modified) value back into the parent vector.
This “copy-on-read, write-on-drop” mechanism allows for an API that feels
like direct mutable access.
Implementations§
Source§impl<'a, T, W, E, B> MutProxy<'a, T, W, E, B>
impl<'a, T, W, E, B> MutProxy<'a, T, W, E, B>
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Consumes the proxy, returning the current value without writing it back.
This can be used to avoid the overhead of a write operation if the value was read but not modified.
Trait Implementations§
Auto Trait Implementations§
impl<'a, T, W, E, B> Freeze for MutProxy<'a, T, W, E, B>where
<W as TryInto<usize>>::Error: Sized,
<W as TryInto<u128>>::Error: Sized,
<W as TryInto<u64>>::Error: Sized,
<W as TryInto<u32>>::Error: Sized,
<W as TryInto<u16>>::Error: Sized,
<W as TryInto<u8>>::Error: Sized,
<W as TryInto<isize>>::Error: Sized,
<W as TryInto<i128>>::Error: Sized,
<W as TryInto<i64>>::Error: Sized,
<W as TryInto<i32>>::Error: Sized,
<W as TryInto<i16>>::Error: Sized,
<W as TryInto<i8>>::Error: Sized,
<W as TryFrom<usize>>::Error: Sized,
<W as TryFrom<u128>>::Error: Sized,
<W as TryFrom<u64>>::Error: Sized,
<W as TryFrom<u32>>::Error: Sized,
<W as TryFrom<u16>>::Error: Sized,
<W as TryFrom<u8>>::Error: Sized,
<W as TryFrom<isize>>::Error: Sized,
<W as TryFrom<i128>>::Error: Sized,
<W as TryFrom<i64>>::Error: Sized,
<W as TryFrom<i32>>::Error: Sized,
<W as TryFrom<i16>>::Error: Sized,
<W as TryFrom<i8>>::Error: Sized,
<W as FromStr>::Err: Sized,
T: Freeze,
impl<'a, T, W, E, B> RefUnwindSafe for MutProxy<'a, T, W, E, B>where
<W as TryInto<usize>>::Error: Sized,
<W as TryInto<u128>>::Error: Sized,
<W as TryInto<u64>>::Error: Sized,
<W as TryInto<u32>>::Error: Sized,
<W as TryInto<u16>>::Error: Sized,
<W as TryInto<u8>>::Error: Sized,
<W as TryInto<isize>>::Error: Sized,
<W as TryInto<i128>>::Error: Sized,
<W as TryInto<i64>>::Error: Sized,
<W as TryInto<i32>>::Error: Sized,
<W as TryInto<i16>>::Error: Sized,
<W as TryInto<i8>>::Error: Sized,
<W as TryFrom<usize>>::Error: Sized,
<W as TryFrom<u128>>::Error: Sized,
<W as TryFrom<u64>>::Error: Sized,
<W as TryFrom<u32>>::Error: Sized,
<W as TryFrom<u16>>::Error: Sized,
<W as TryFrom<u8>>::Error: Sized,
<W as TryFrom<isize>>::Error: Sized,
<W as TryFrom<i128>>::Error: Sized,
<W as TryFrom<i64>>::Error: Sized,
<W as TryFrom<i32>>::Error: Sized,
<W as TryFrom<i16>>::Error: Sized,
<W as TryFrom<i8>>::Error: Sized,
<W as FromStr>::Err: Sized,
T: RefUnwindSafe,
B: RefUnwindSafe,
E: RefUnwindSafe,
impl<'a, T, W, E, B> Send for MutProxy<'a, T, W, E, B>where
<W as TryInto<usize>>::Error: Sized,
<W as TryInto<u128>>::Error: Sized,
<W as TryInto<u64>>::Error: Sized,
<W as TryInto<u32>>::Error: Sized,
<W as TryInto<u16>>::Error: Sized,
<W as TryInto<u8>>::Error: Sized,
<W as TryInto<isize>>::Error: Sized,
<W as TryInto<i128>>::Error: Sized,
<W as TryInto<i64>>::Error: Sized,
<W as TryInto<i32>>::Error: Sized,
<W as TryInto<i16>>::Error: Sized,
<W as TryInto<i8>>::Error: Sized,
<W as TryFrom<usize>>::Error: Sized,
<W as TryFrom<u128>>::Error: Sized,
<W as TryFrom<u64>>::Error: Sized,
<W as TryFrom<u32>>::Error: Sized,
<W as TryFrom<u16>>::Error: Sized,
<W as TryFrom<u8>>::Error: Sized,
<W as TryFrom<isize>>::Error: Sized,
<W as TryFrom<i128>>::Error: Sized,
<W as TryFrom<i64>>::Error: Sized,
<W as TryFrom<i32>>::Error: Sized,
<W as TryFrom<i16>>::Error: Sized,
<W as TryFrom<i8>>::Error: Sized,
<W as FromStr>::Err: Sized,
T: Send,
B: Send,
impl<'a, T, W, E, B> Sync for MutProxy<'a, T, W, E, B>where
<W as TryInto<usize>>::Error: Sized,
<W as TryInto<u128>>::Error: Sized,
<W as TryInto<u64>>::Error: Sized,
<W as TryInto<u32>>::Error: Sized,
<W as TryInto<u16>>::Error: Sized,
<W as TryInto<u8>>::Error: Sized,
<W as TryInto<isize>>::Error: Sized,
<W as TryInto<i128>>::Error: Sized,
<W as TryInto<i64>>::Error: Sized,
<W as TryInto<i32>>::Error: Sized,
<W as TryInto<i16>>::Error: Sized,
<W as TryInto<i8>>::Error: Sized,
<W as TryFrom<usize>>::Error: Sized,
<W as TryFrom<u128>>::Error: Sized,
<W as TryFrom<u64>>::Error: Sized,
<W as TryFrom<u32>>::Error: Sized,
<W as TryFrom<u16>>::Error: Sized,
<W as TryFrom<u8>>::Error: Sized,
<W as TryFrom<isize>>::Error: Sized,
<W as TryFrom<i128>>::Error: Sized,
<W as TryFrom<i64>>::Error: Sized,
<W as TryFrom<i32>>::Error: Sized,
<W as TryFrom<i16>>::Error: Sized,
<W as TryFrom<i8>>::Error: Sized,
<W as FromStr>::Err: Sized,
T: Sync,
B: Sync,
impl<'a, T, W, E, B> Unpin for MutProxy<'a, T, W, E, B>where
<W as TryInto<usize>>::Error: Sized,
<W as TryInto<u128>>::Error: Sized,
<W as TryInto<u64>>::Error: Sized,
<W as TryInto<u32>>::Error: Sized,
<W as TryInto<u16>>::Error: Sized,
<W as TryInto<u8>>::Error: Sized,
<W as TryInto<isize>>::Error: Sized,
<W as TryInto<i128>>::Error: Sized,
<W as TryInto<i64>>::Error: Sized,
<W as TryInto<i32>>::Error: Sized,
<W as TryInto<i16>>::Error: Sized,
<W as TryInto<i8>>::Error: Sized,
<W as TryFrom<usize>>::Error: Sized,
<W as TryFrom<u128>>::Error: Sized,
<W as TryFrom<u64>>::Error: Sized,
<W as TryFrom<u32>>::Error: Sized,
<W as TryFrom<u16>>::Error: Sized,
<W as TryFrom<u8>>::Error: Sized,
<W as TryFrom<isize>>::Error: Sized,
<W as TryFrom<i128>>::Error: Sized,
<W as TryFrom<i64>>::Error: Sized,
<W as TryFrom<i32>>::Error: Sized,
<W as TryFrom<i16>>::Error: Sized,
<W as TryFrom<i8>>::Error: Sized,
<W as FromStr>::Err: Sized,
T: Unpin,
impl<'a, T, W, E, B> UnsafeUnpin for MutProxy<'a, T, W, E, B>where
<W as TryInto<usize>>::Error: Sized,
<W as TryInto<u128>>::Error: Sized,
<W as TryInto<u64>>::Error: Sized,
<W as TryInto<u32>>::Error: Sized,
<W as TryInto<u16>>::Error: Sized,
<W as TryInto<u8>>::Error: Sized,
<W as TryInto<isize>>::Error: Sized,
<W as TryInto<i128>>::Error: Sized,
<W as TryInto<i64>>::Error: Sized,
<W as TryInto<i32>>::Error: Sized,
<W as TryInto<i16>>::Error: Sized,
<W as TryInto<i8>>::Error: Sized,
<W as TryFrom<usize>>::Error: Sized,
<W as TryFrom<u128>>::Error: Sized,
<W as TryFrom<u64>>::Error: Sized,
<W as TryFrom<u32>>::Error: Sized,
<W as TryFrom<u16>>::Error: Sized,
<W as TryFrom<u8>>::Error: Sized,
<W as TryFrom<isize>>::Error: Sized,
<W as TryFrom<i128>>::Error: Sized,
<W as TryFrom<i64>>::Error: Sized,
<W as TryFrom<i32>>::Error: Sized,
<W as TryFrom<i16>>::Error: Sized,
<W as TryFrom<i8>>::Error: Sized,
<W as FromStr>::Err: Sized,
T: UnsafeUnpin,
impl<'a, T, W, E, B> !UnwindSafe for MutProxy<'a, T, W, E, B>
Blanket Implementations§
Source§impl<R> TryRngCore for Rwhere
R: TryRng,
impl<R> TryRngCore for Rwhere
R: TryRng,
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
Source§impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
impl<T, U> CastableInto<U> for Twhere
U: CastableFrom<T>,
Source§impl<T> DowncastableFrom<T> for T
impl<T> DowncastableFrom<T> for T
Source§fn downcast_from(value: T) -> T
fn downcast_from(value: T) -> T
Truncate the current UnsignedInt to a possibly smaller size
Source§impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
impl<T, U> DowncastableInto<U> for Twhere
U: DowncastableFrom<T>,
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
Source§impl<R> RngExt for R
impl<R> RngExt for R
Source§fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
Return a random value via the
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>,
Generate a random value in the given range. Read more
Source§fn random_bool(&mut self, p: f64) -> bool
fn random_bool(&mut self, p: f64) -> bool
Return a bool with a probability
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
Return a bool with a probability of
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>,
Sample a new value, using the given distribution. Read more
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,
Create an iterator that generates values using the given distribution. Read more
Source§impl<R> TryRng for R
impl<R> TryRng for R
Source§impl<T> UpcastableFrom<T> for T
impl<T> UpcastableFrom<T> for T
Source§fn upcast_from(value: T) -> T
fn upcast_from(value: T) -> T
Extend the current UnsignedInt to a possibly bigger size.