Struct LinkedChunkBuilder
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§
§impl<const CAP: usize, Item, Gap> LinkedChunkBuilder<CAP, Item, Gap>
impl<const CAP: usize, Item, Gap> LinkedChunkBuilder<CAP, Item, Gap>
pub fn new() -> LinkedChunkBuilder<CAP, Item, Gap>
pub fn new() -> LinkedChunkBuilder<CAP, Item, Gap>
Create an empty LinkedChunkBuilder
with no update history.
pub 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()
.
pub 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()
.
pub 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
.
pub fn build( self, ) -> Result<Option<LinkedChunk<CAP, Item, Gap>>, LinkedChunkBuilderError>
pub fn from_raw_parts(
raws: Vec<RawChunk<Item, Gap>>,
) -> LinkedChunkBuilder<CAP, Item, Gap>
pub fn from_raw_parts( raws: Vec<RawChunk<Item, Gap>>, ) -> LinkedChunkBuilder<CAP, Item, Gap>
Fills a linked chunk builder from all the given raw parts.
Trait Implementations§
§impl<const CAP: usize, Item, Gap> Default for LinkedChunkBuilder<CAP, Item, Gap>
impl<const CAP: usize, Item, Gap> Default for LinkedChunkBuilder<CAP, Item, Gap>
§fn default() -> LinkedChunkBuilder<CAP, Item, Gap>
fn default() -> LinkedChunkBuilder<CAP, Item, Gap>
Auto Trait Implementations§
impl<const CAP: usize, Item, Gap> Freeze for LinkedChunkBuilder<CAP, Item, Gap>
impl<const CAP: usize, Item, Gap> RefUnwindSafe for LinkedChunkBuilder<CAP, Item, Gap>where
Gap: RefUnwindSafe,
Item: RefUnwindSafe,
impl<const CAP: usize, Item, Gap> Send for LinkedChunkBuilder<CAP, Item, Gap>
impl<const CAP: usize, Item, Gap> Sync for LinkedChunkBuilder<CAP, Item, Gap>
impl<const CAP: usize, Item, Gap> Unpin for LinkedChunkBuilder<CAP, Item, Gap>
impl<const CAP: usize, Item, Gap> UnwindSafe for LinkedChunkBuilder<CAP, Item, Gap>where
Gap: RefUnwindSafe,
Item: RefUnwindSafe,
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
§impl<T> CompatExt for T
impl<T> CompatExt for T
Source§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
Source§fn consume_handle(handle: Handle) -> Arc<T>
fn consume_handle(handle: Handle) -> Arc<T>
Arc<>
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§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