pub enum Update<Item, Gap> {
NewItemsChunk {
previous: Option<ChunkIdentifier>,
new: ChunkIdentifier,
next: Option<ChunkIdentifier>,
},
NewGapChunk {
previous: Option<ChunkIdentifier>,
new: ChunkIdentifier,
next: Option<ChunkIdentifier>,
gap: Gap,
},
RemoveChunk(ChunkIdentifier),
PushItems {
at: Position,
items: Vec<Item>,
},
RemoveItem {
at: Position,
},
DetachLastItems {
at: Position,
},
StartReattachItems,
EndReattachItems,
Clear,
}
Expand description
Represent the updates that have happened inside a LinkedChunk
.
To retrieve the updates, use LinkedChunk::updates
.
These updates are useful to store a LinkedChunk
in another form of
storage, like a database or something similar.
Variants§
NewItemsChunk
A new chunk of kind Items has been created.
Fields
previous: Option<ChunkIdentifier>
The identifier of the previous chunk of this new chunk.
new: ChunkIdentifier
The identifier of the new chunk.
next: Option<ChunkIdentifier>
The identifier of the next chunk of this new chunk.
NewGapChunk
A new chunk of kind Gap has been created.
Fields
previous: Option<ChunkIdentifier>
The identifier of the previous chunk of this new chunk.
new: ChunkIdentifier
The identifier of the new chunk.
next: Option<ChunkIdentifier>
The identifier of the next chunk of this new chunk.
gap: Gap
The content of the chunk.
RemoveChunk(ChunkIdentifier)
A chunk has been removed.
PushItems
Items are pushed inside a chunk of kind Items.
Fields
at: Position
The Position
of the items.
This value is given to prevent the need for position computations by
the update readers. Items are pushed, so the positions should be
incrementally computed from the previous items, which requires the
reading of the last previous item. With at
, the update readers no
longer need to do so.
RemoveItem
An item has been removed inside a chunk of kind Items.
DetachLastItems
The last items of a chunk have been detached, i.e. the chunk has been truncated.
Fields
StartReattachItems
Detached items (see Self::DetachLastItems
) starts being reattached.
EndReattachItems
Reattaching items (see Self::StartReattachItems
) is finished.
Clear
All chunks have been cleared, i.e. all items and all gaps have been dropped.
Trait Implementations§
impl<Item, Gap> StructuralPartialEq for Update<Item, Gap>
Auto Trait Implementations§
impl<Item, Gap> Freeze for Update<Item, Gap>where
Gap: Freeze,
impl<Item, Gap> RefUnwindSafe for Update<Item, Gap>where
Gap: RefUnwindSafe,
Item: RefUnwindSafe,
impl<Item, Gap> Send for Update<Item, Gap>
impl<Item, Gap> Sync for Update<Item, Gap>
impl<Item, Gap> Unpin for Update<Item, Gap>
impl<Item, Gap> UnwindSafe for Update<Item, Gap>where
Gap: UnwindSafe,
Item: UnwindSafe,
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<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
Source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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 more