Skip to main content

VecObserverState

Struct VecObserverState 

Source
pub struct VecObserverState<O> { /* private fields */ }
Expand description

Observer state for dynamically-sized slices (Vec<T>, Box<[T]>), tracking Append and Truncate boundaries.

The append_index divides the observed slice into two regions: elements before it are “existing” (may have individual observer state), and elements from append_index onward are “appended” (new since the last flush).

§Replace Semantics

During flush, if all existing elements’ inner observers report Replace and there was at least some tracked content (append_index > 0 or truncate_len > 0), the granular mutations are collapsed into a single whole-slice Replace.

Trait Implementations§

Source§

impl<O> ObserverState for VecObserverState<O>
where O: Observer<InnerDepth = Zero, Head: Sized>,

Source§

type Target = [<O as QuasiObserver>::Head]

The observed value type that this state tracks.
Source§

fn invalidate(this: &mut Self, _: &[O::Head])

Invalidates all granular tracking state. The next flush should produce a Replace mutation. Read more
Source§

impl<O> SliceObserverState for VecObserverState<O>
where O: Observer<InnerDepth = Zero, Head: Sized>,

Source§

type Item = O

The element Observer type.
Source§

fn as_slice(&self) -> &[Self::Item]

Returns a shared slice of element observers.
Source§

fn as_mut_slice(&mut self) -> &mut [Self::Item]

Returns a mutable slice of element observers.
Source§

fn observe(slice: &mut Self::Target) -> Self

Creates an Observer collection for the given slice.
Source§

unsafe fn relocate(&self, slice: &mut Self::Target)

Ensures element observers exist for all elements and updates their pointers. Read more
Source§

impl<O, S, D> SliceSerializeObserverState<S, D> for VecObserverState<O>
where D: Unsigned, S: AsDerefMut<D, Target = [O::Head]> + ?Sized, O: Observer<InnerDepth = Zero> + SerializeObserver, O::Head: Serialize + Sized + 'static,

Source§

fn flush(&mut self, ptr: &mut Pointer<S>) -> Mutations

Consumes the accumulated mutation state, flushes inner element observers, and returns the collected Mutations. Read more

Auto Trait Implementations§

§

impl<O> !Freeze for VecObserverState<O>

§

impl<O> !RefUnwindSafe for VecObserverState<O>

§

impl<O> Send for VecObserverState<O>
where O: Send,

§

impl<O> !Sync for VecObserverState<O>

§

impl<O> Unpin for VecObserverState<O>
where O: Unpin,

§

impl<O> UnsafeUnpin for VecObserverState<O>

§

impl<O> UnwindSafe for VecObserverState<O>
where O: UnwindSafe,

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> 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> 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<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.