Skip to main content

ArrayObserver

Struct ArrayObserver 

Source
pub struct ArrayObserver<'ob, const N: usize, O, S: ?Sized, D = Zero> { /* private fields */ }
Expand description

Observer implementation for arrays [T; N].

Implementations§

Source§

impl<'ob, const N: usize, O, S, D, T> ArrayObserver<'ob, N, O, S, D>
where D: Unsigned, S: AsDerefMut<D, Target = [T; N]> + 'ob + ?Sized, O: Observer<'ob, InnerDepth = Zero, Head = T> + 'ob, T: 'ob,

Source

pub fn as_slice(&self) -> &[O]

Source

pub fn as_mut_slice(&mut self) -> &mut [O]

Source

pub fn each_ref(&self) -> [&O; N]

Source

pub fn each_mut(&mut self) -> [&mut O; N]

Methods from Deref<Target = SliceObserver<'ob, [O; N], (), S, D>>§

Source

pub fn first_mut(&mut self) -> Option<&mut O>

Source

pub fn split_first_mut(&mut self) -> Option<(&mut O, &mut [O])>

Source

pub fn split_last_mut(&mut self) -> Option<(&mut O, &mut [O])>

Source

pub fn last_mut(&mut self) -> Option<&mut O>

Source

pub fn first_chunk_mut<const N: usize>(&mut self) -> Option<&mut [O; N]>

Source

pub fn split_first_chunk_mut<const N: usize>( &mut self, ) -> Option<(&mut [O; N], &mut [O])>

Source

pub fn split_last_chunk_mut<const N: usize>( &mut self, ) -> Option<(&mut [O], &mut [O; N])>

Source

pub fn last_chunk_mut<const N: usize>(&mut self) -> Option<&mut [O; N]>

Source

pub fn get_mut(&mut self, index: usize) -> Option<&mut O>

Source

pub fn swap(&mut self, a: usize, b: usize)

Source

pub fn iter_mut(&mut self) -> IterMut<'_, O>

Source

pub fn chunks_mut(&mut self, chunk_size: usize) -> ChunksMut<'_, O>

Source

pub fn chunks_exact_mut(&mut self, chunk_size: usize) -> ChunksExactMut<'_, O>

Source

pub fn as_chunks_mut<const N: usize>(&mut self) -> (&mut [[O; N]], &mut [O])

Source

pub fn as_rchunks_mut<const N: usize>(&mut self) -> (&mut [O], &mut [[O; N]])

Source

pub fn rchunks_mut(&mut self, chunk_size: usize) -> RChunksMut<'_, O>

Source

pub fn rchunks_exact_mut(&mut self, chunk_size: usize) -> RChunksExactMut<'_, O>

Source

pub fn chunk_by_mut<F>(&mut self, pred: F) -> ChunkByMut<'_, O, F>
where F: FnMut(&O, &O) -> bool,

Source

pub fn split_at_mut(&mut self, mid: usize) -> (&mut [O], &mut [O])

Source

pub fn split_at_mut_checked( &mut self, mid: usize, ) -> Option<(&mut [O], &mut [O])>

Source

pub fn split_mut<F>(&mut self, pred: F) -> SplitMut<'_, O, F>
where F: FnMut(&O) -> bool,

Source

pub fn split_inclusive_mut<F>(&mut self, pred: F) -> SplitInclusiveMut<'_, O, F>
where F: FnMut(&O) -> bool,

Source

pub fn rsplit_mut<F>(&mut self, pred: F) -> RSplitMut<'_, O, F>
where F: FnMut(&O) -> bool,

Source

pub fn splitn_mut<F>(&mut self, n: usize, pred: F) -> SplitNMut<'_, O, F>
where F: FnMut(&O) -> bool,

Source

pub fn rsplitn_mut<F>(&mut self, n: usize, pred: F) -> RSplitNMut<'_, O, F>
where F: FnMut(&O) -> bool,

Trait Implementations§

Source§

impl<'ob, const N: usize, O, S: ?Sized, D> AsNormalized for ArrayObserver<'ob, N, O, S, D>

Source§

type OuterDepth = Succ<Succ<Zero>>

The number of outer dereference layers to reach the normalized value.
Source§

fn as_normalized_ref(&self) -> &Self::Target

Returns a normalized reference to the underlying value.
Source§

fn as_normalized_mut(&mut self) -> &mut Self::Target
where Self: AsDerefMutCoinductive<Self::OuterDepth>,

Returns a normalized mutable reference to the underlying value.
Source§

impl<'ob, const N: usize, O, S, D, T> Debug for ArrayObserver<'ob, N, O, S, D>
where D: Unsigned, S: AsDerefMut<D, Target = [T; N]> + ?Sized, O: Observer<'ob, InnerDepth = Zero, Head = T>, T: Debug,

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'ob, const N: usize, O, S: ?Sized, D> Deref for ArrayObserver<'ob, N, O, S, D>

Source§

type Target = SliceObserver<'ob, [O; N], (), S, D>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.
Source§

impl<'ob, const N: usize, O, S: ?Sized, D> DerefMut for ArrayObserver<'ob, N, O, S, D>

Source§

fn deref_mut(&mut self) -> &mut Self::Target

Mutably dereferences the value.
Source§

impl<'ob, const N: usize, O, S, D, T, I> Index<I> for ArrayObserver<'ob, N, O, S, D>
where D: Unsigned, S: AsDerefMut<D, Target = Vec<T>> + 'ob + ?Sized, O: Observer<'ob, InnerDepth = Zero, Head = T> + 'ob, T: 'ob, I: SliceIndex<[O]> + SliceIndexImpl<[O], I::Output>,

Source§

type Output = <I as SliceIndex<[O]>>::Output

The returned type after indexing.
Source§

fn index(&self, index: I) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<'ob, const N: usize, O, S, D, T, I> IndexMut<I> for ArrayObserver<'ob, N, O, S, D>
where D: Unsigned, S: AsDerefMut<D, Target = Vec<T>> + 'ob + ?Sized, O: Observer<'ob, InnerDepth = Zero, Head = T> + 'ob, T: 'ob, I: SliceIndex<[O]> + SliceIndexImpl<[O], I::Output>,

Source§

fn index_mut(&mut self, index: I) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<'ob, const N: usize, O, S, D, T> Observer<'ob> for ArrayObserver<'ob, N, O, S, D>
where D: Unsigned, S: AsDerefMut<D, Target = [T; N]> + 'ob + ?Sized, O: Observer<'ob, InnerDepth = Zero, Head = T>,

Source§

type InnerDepth = D

Type-level number of dereferences from Head to the observed type.
Source§

type Head = S

The head type of the dereference chain.
Source§

fn uninit() -> Self

Creates an uninitialized observer. Read more
Source§

fn observe(value: &'ob mut Self::Head) -> Self

Creates a new observer for the given value. Read more
Source§

unsafe fn refresh(this: &mut Self, value: &mut Self::Head)

Refreshes the observer’s internal pointer after the observed value has moved. Read more
Source§

unsafe fn force(this: &mut Self, value: &'ob mut Self::Head)

Forces the observer into a valid state for the given value. Read more
Source§

fn as_inner<'i>( this: &Self, ) -> &'i mut <Self::Head as AsDeref<Self::InnerDepth>>::Target
where Self::Head: AsDerefMut<Self::InnerDepth>, 'ob: 'i,

Gets a mutable reference to the inner observed value without triggering observation. Read more
Source§

fn track_inner<'i>( this: &mut Self, ) -> &'i mut <Self::Head as AsDeref<Self::InnerDepth>>::Target
where Self::Head: AsDerefMut<Self::InnerDepth>, 'ob: 'i,

Gets a mutable reference to the inner observed value while triggering observation. Read more
Source§

impl<'ob, const N: usize, O, S, D, T, U> PartialEq<U> for ArrayObserver<'ob, N, O, S, D>
where D: Unsigned, S: AsDerefMut<D, Target = [T; N]> + ?Sized, O: Observer<'ob, InnerDepth = Zero, Head = T>, [T; N]: PartialEq<U>,

Source§

fn eq(&self, other: &U) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<'ob, const N: usize, O, S, D, T, U> PartialOrd<U> for ArrayObserver<'ob, N, O, S, D>
where D: Unsigned, S: AsDerefMut<D, Target = [T; N]> + ?Sized, O: Observer<'ob, InnerDepth = Zero, Head = T>, [T; N]: PartialOrd<U>,

Source§

fn partial_cmp(&self, other: &U) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<'ob, const N: usize, O, S, D, T> SerializeObserver<'ob> for ArrayObserver<'ob, N, O, S, D>
where D: Unsigned, S: AsDerefMut<D, Target = [T; N]> + 'ob + ?Sized, O: SerializeObserver<'ob, InnerDepth = Zero, Head = T>, T: Serialize,

Source§

unsafe fn flush_unchecked<A: Adapter>( this: &mut Self, ) -> Result<Mutations<A::Value>, A::Error>

Flushes and serializes all recorded mutations (unsafe version). Read more
Source§

fn flush<A: Adapter>(this: &mut Self) -> Result<Mutations<A::Value>, A::Error>

Flushes and serializes all recorded mutations using the specified adapter. Read more

Auto Trait Implementations§

§

impl<'ob, const N: usize, O, S, D = Zero> !Freeze for ArrayObserver<'ob, N, O, S, D>

§

impl<'ob, const N: usize, O, S, D = Zero> !RefUnwindSafe for ArrayObserver<'ob, N, O, S, D>

§

impl<'ob, const N: usize, O, S, D = Zero> !Send for ArrayObserver<'ob, N, O, S, D>

§

impl<'ob, const N: usize, O, S, D = Zero> !Sync for ArrayObserver<'ob, N, O, S, D>

§

impl<'ob, const N: usize, O, S, D> Unpin for ArrayObserver<'ob, N, O, S, D>
where O: Unpin, S: ?Sized,

§

impl<'ob, const N: usize, O, S, D = Zero> !UnwindSafe for ArrayObserver<'ob, N, O, S, D>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> AsDeref<Zero> for T
where T: ?Sized,

Source§

type Target = T

The target type after N dereferences.
Source§

fn as_deref(&self) -> &T

Dereferences self N times.
Source§

impl<T, N> AsDerefCoinductive<Succ<N>> for T
where T: Deref + ?Sized, <T as Deref>::Target: AsDerefCoinductive<N>, N: Unsigned,

Source§

type Target = <<T as Deref>::Target as AsDerefCoinductive<N>>::Target

The target type after N dereferences.
Source§

fn as_deref_coinductive(&self) -> &<T as AsDerefCoinductive<Succ<N>>>::Target

Dereferences self N times.
Source§

impl<T> AsDerefCoinductive<Zero> for T
where T: ?Sized,

Source§

type Target = T

The target type after N dereferences.
Source§

fn as_deref_coinductive(&self) -> &T

Dereferences self N times.
Source§

impl<T> AsDerefMut<Zero> for T
where T: ?Sized,

Source§

fn as_deref_mut(&mut self) -> &mut T

Mutably dereferences self N times.
Source§

impl<T, N> AsDerefMutCoinductive<Succ<N>> for T

Source§

fn as_deref_mut_coinductive( &mut self, ) -> &mut <T as AsDerefCoinductive<Succ<N>>>::Target

Mutably dereferences self N times.
Source§

impl<T> AsDerefMutCoinductive<Zero> for T
where T: ?Sized,

Source§

fn as_deref_mut_coinductive(&mut self) -> &mut T

Mutably dereferences self N times.
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<P, T> Receiver for P
where P: Deref<Target = T> + ?Sized, T: ?Sized,

Source§

type Target = T

🔬This is a nightly-only experimental API. (arbitrary_self_types)
The target type on which the method may be called.
Source§

impl<'ob, T> SerializeObserverExt<'ob> for T
where T: SerializeObserver<'ob>,

Source§

fn flush<A: Adapter>(&mut self) -> Result<A, A::Error>

Collects mutations using the specified adapter. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.