pub struct Chunker { /* private fields */ }Expand description
Chunker for splitting large data into blocks
Implementations§
Source§impl Chunker
impl Chunker
Sourcepub fn with_config(config: ChunkingConfig) -> Self
pub fn with_config(config: ChunkingConfig) -> Self
Create a chunker with custom configuration
Sourcepub fn chunk(&self, data: &[u8]) -> Result<ChunkedFile>
pub fn chunk(&self, data: &[u8]) -> Result<ChunkedFile>
Chunk data into a Merkle DAG structure
Returns the root CID and all generated blocks
Sourcepub fn needs_chunking(&self, data_len: usize) -> bool
pub fn needs_chunking(&self, data_len: usize) -> bool
Check if data would need to be chunked
Sourcepub fn estimate_chunk_count(&self, data_len: usize) -> usize
pub fn estimate_chunk_count(&self, data_len: usize) -> usize
Estimate the number of chunks for a given data size
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Chunker
impl RefUnwindSafe for Chunker
impl Send for Chunker
impl Sync for Chunker
impl Unpin for Chunker
impl UnwindSafe for Chunker
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