pub struct LinkedChunkBuilder<const CAP: usize, Item, Gap> { /* private fields */ }
Expand description
A data structure to rebuild a linked chunk from its raw representation.
A linked chunk can be rebuilt incrementally from its internal
representation, with the chunks being added in any order, as long as they
form a single connected component eventually (viz., there’s no
subgraphs/sublists isolated from the one final linked list). If they don’t,
then the final call to LinkedChunkBuilder::build()
will result in an
error).
Implementations§
Source§impl<const CAP: usize, Item, Gap> LinkedChunkBuilder<CAP, Item, Gap>
impl<const CAP: usize, Item, Gap> LinkedChunkBuilder<CAP, Item, Gap>
Sourcepub fn new() -> Self
pub fn new() -> Self
Create an empty LinkedChunkBuilder
with no update history.
Sourcepub fn push_gap(
&mut self,
previous: Option<ChunkIdentifier>,
id: ChunkIdentifier,
next: Option<ChunkIdentifier>,
content: Gap,
)
pub fn push_gap( &mut self, previous: Option<ChunkIdentifier>, id: ChunkIdentifier, next: Option<ChunkIdentifier>, content: Gap, )
Stash a gap chunk with its content.
This can be called even if the previous and next chunks have not been
added yet. Resolving these chunks will happen at the time of calling
LinkedChunkBuilder::build()
.
Sourcepub fn push_items(
&mut self,
previous: Option<ChunkIdentifier>,
id: ChunkIdentifier,
next: Option<ChunkIdentifier>,
items: impl IntoIterator<Item = Item>,
)
pub fn push_items( &mut self, previous: Option<ChunkIdentifier>, id: ChunkIdentifier, next: Option<ChunkIdentifier>, items: impl IntoIterator<Item = Item>, )
Stash an item chunk with its contents.
This can be called even if the previous and next chunks have not been
added yet. Resolving these chunks will happen at the time of calling
LinkedChunkBuilder::build()
.
Sourcepub fn with_update_history(&mut self)
pub fn with_update_history(&mut self)
Request that the resulting linked chunk will have an update history, as
if it were created with LinkedChunk::new_with_update_history
.