Skip to main content

VecObserver

Struct VecObserver 

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

Observer implementation for Vec<T>.

Implementations§

Source§

impl<'ob, O, S, D, T> VecObserver<'ob, O, S, D>
where D: Unsigned, S: AsDerefMut<D, Target = Vec<T>> + 'ob + ?Sized, O: Observer<'ob, InnerDepth = Zero, Head = T> + 'ob, T: 'ob,

Source

pub fn reserve(&mut self, additional: usize)

Source

pub fn reserve_exact(&mut self, additional: usize)

Source

pub fn try_reserve(&mut self, additional: usize) -> Result<(), TryReserveError>

Source

pub fn try_reserve_exact( &mut self, additional: usize, ) -> Result<(), TryReserveError>

Source

pub fn shrink_to_fit(&mut self)

Source

pub fn shrink_to(&mut self, min_capacity: usize)

Source

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

Source

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

Source§

impl<'ob, O, S, D, T> VecObserver<'ob, O, S, D>
where D: Unsigned, S: AsDerefMut<D, Target = Vec<T>> + 'ob + ?Sized, O: Observer<'ob, InnerDepth = Zero, Head = T> + 'ob, T: 'ob,

Source

pub fn push(&mut self, value: T)

Available on crate feature append only.

See Vec::push.

Source

pub fn append(&mut self, other: &mut Vec<T>)

Available on crate feature append only.
Source

pub fn insert(&mut self, index: usize, element: T)

Available on crate feature append only.
Source§

impl<'ob, O, S, D, T> VecObserver<'ob, O, S, D>
where D: Unsigned, S: AsDerefMut<D, Target = Vec<T>> + 'ob + ?Sized, O: Observer<'ob, InnerDepth = Zero, Head = T> + 'ob, T: 'ob,

Source

pub fn clear(&mut self)

Available on crate features append or truncate only.
Source

pub fn remove(&mut self, index: usize) -> T

Available on crate features append or truncate only.
Source

pub fn swap_remove(&mut self, index: usize) -> T

Available on crate features append or truncate only.
Source

pub fn pop(&mut self) -> Option<T>

Available on crate features append or truncate only.

See Vec::pop.

Source

pub fn pop_if(&mut self, predicate: impl FnOnce(&mut O) -> bool) -> Option<T>

Available on crate features append or truncate only.
Source

pub fn truncate(&mut self, len: usize)

Available on crate features append or truncate only.
Source

pub fn split_off(&mut self, at: usize) -> Vec<T>

Available on crate features append or truncate only.
Source

pub fn resize_with<F>(&mut self, new_len: usize, f: F)
where F: FnMut() -> T,

Available on crate features append or truncate only.
Source

pub fn drain<R>(&mut self, range: R) -> Drain<'_, T>
where R: RangeBounds<usize>,

Available on crate features append or truncate only.
Source

pub fn splice<R, I>( &mut self, range: R, replace_with: I, ) -> Splice<'_, I::IntoIter>
where R: RangeBounds<usize>, I: IntoIterator<Item = T>,

Available on crate features append or truncate only.
Source

pub fn extract_if<F, R>(&mut self, range: R, filter: F) -> ExtractIf<'_, T, F>
where F: FnMut(&mut T) -> bool, R: RangeBounds<usize>,

Available on crate features append or truncate only.
Source§

impl<'ob, O, S, D, T> VecObserver<'ob, O, S, D>
where D: Unsigned, S: AsDerefMut<D, Target = Vec<T>> + 'ob + ?Sized, O: Observer<'ob, InnerDepth = Zero, Head = T> + 'ob, T: Clone + 'ob,

Source

pub fn extend_from_slice(&mut self, other: &[T])

Available on crate feature append only.
Source

pub fn extend_from_within<R>(&mut self, src: R)
where R: RangeBounds<usize>,

Available on crate feature append only.
Source§

impl<'ob, O, S, D, T> VecObserver<'ob, O, S, D>
where D: Unsigned, S: AsDerefMut<D, Target = Vec<T>> + 'ob + ?Sized, O: Observer<'ob, InnerDepth = Zero, Head = T> + 'ob, T: Clone + 'ob,

Source

pub fn resize(&mut self, new_len: usize, value: T)

Available on crate features append or truncate only.

Methods from Deref<Target = SliceObserver<'ob, UnsafeCell<Vec<O>>, TruncateAppend, S, Succ<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, O, S: ?Sized, D> AsNormalized for VecObserver<'ob, 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, O, S, D, T> Debug for VecObserver<'ob, O, S, D>
where D: Unsigned, S: AsDerefMut<D, Target = Vec<T>> + ?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, O, S: ?Sized, D> Deref for VecObserver<'ob, O, S, D>

Source§

type Target = SliceObserver<'ob, UnsafeCell<Vec<O>>, TruncateAppend, S, Succ<D>>

The resulting type after dereferencing.
Source§

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

Dereferences the value.
Source§

impl<'ob, O, S: ?Sized, D> DerefMut for VecObserver<'ob, O, S, D>

Source§

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

Mutably dereferences the value.
Source§

impl<'ob, O, S, D, T, U> Extend<U> for VecObserver<'ob, O, S, D>
where D: Unsigned, S: AsDerefMut<D, Target = Vec<T>> + 'ob + ?Sized, O: Observer<'ob, InnerDepth = Zero, Head = T>, T: 'ob, Vec<T>: Extend<U>,

Available on crate feature append only.
Source§

fn extend<I: IntoIterator<Item = U>>(&mut self, other: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<'ob, O, S, D, T, I> Index<I> for VecObserver<'ob, 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, O, S, D, T, I> IndexMut<I> for VecObserver<'ob, 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, O, S, D, T> Observer<'ob> for VecObserver<'ob, O, S, D>
where D: Unsigned, S: AsDerefMut<D, Target = Vec<T>> + '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, O, S, D, T, U> PartialEq<U> for VecObserver<'ob, O, S, D>
where D: Unsigned, S: AsDerefMut<D, Target = Vec<T>> + ?Sized, O: Observer<'ob, InnerDepth = Zero, Head = T>, Vec<T>: 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, O, S, D, T, U> PartialOrd<U> for VecObserver<'ob, O, S, D>
where D: Unsigned, S: AsDerefMut<D, Target = Vec<T>> + ?Sized, O: Observer<'ob, InnerDepth = Zero, Head = T>, Vec<T>: 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, O, S, D, T> SerializeObserver<'ob> for VecObserver<'ob, O, S, D>
where D: Unsigned, S: AsDerefMut<D, Target = Vec<T>> + '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, O, S, D = Zero> !Freeze for VecObserver<'ob, O, S, D>

§

impl<'ob, O, S, D = Zero> !RefUnwindSafe for VecObserver<'ob, O, S, D>

§

impl<'ob, O, S, D = Zero> !Send for VecObserver<'ob, O, S, D>

§

impl<'ob, O, S, D = Zero> !Sync for VecObserver<'ob, O, S, D>

§

impl<'ob, O, S, D> Unpin for VecObserver<'ob, O, S, D>
where O: Unpin, S: ?Sized,

§

impl<'ob, O, S, D = Zero> !UnwindSafe for VecObserver<'ob, 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.