pub struct ContentChunker { /* private fields */ }Expand description
Splits a byte stream into content-defined chunks.
Implementations§
Source§impl ContentChunker
impl ContentChunker
Sourcepub fn new(config: ChunkerConfig) -> Self
pub fn new(config: ChunkerConfig) -> Self
Create a new chunker with the given configuration.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Create a chunker with default configuration.
Sourcepub fn feed(&mut self, data: &[u8]) -> Vec<ChunkBoundary>
pub fn feed(&mut self, data: &[u8]) -> Vec<ChunkBoundary>
Feed a chunk of data and detect boundaries within it.
Returns the boundaries found in this batch.
Sourcepub fn finish(&mut self) -> Option<ChunkBoundary>
pub fn finish(&mut self) -> Option<ChunkBoundary>
Finalise the chunker, emitting a boundary for any trailing data.
Sourcepub fn boundaries(&self) -> &[ChunkBoundary]
pub fn boundaries(&self) -> &[ChunkBoundary]
Return all detected boundaries so far.
Auto Trait Implementations§
impl Freeze for ContentChunker
impl RefUnwindSafe for ContentChunker
impl Send for ContentChunker
impl Sync for ContentChunker
impl Unpin for ContentChunker
impl UnsafeUnpin for ContentChunker
impl UnwindSafe for ContentChunker
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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