Skip to main content

SplitMode

Trait SplitMode 

Source
pub trait SplitMode: JoinMode {
    type RefBytes: AsRef<[u8]> + AsMut<[u8]> + Clone + Debug + Send + Sync;

    // Required methods
    fn prepare_chunk<const BS: usize>(
        data: Vec<u8>,
    ) -> Result<(ContentChunk<BS>, Self::RefBytes)>;
    fn empty_chunk<const BS: usize>(    ) -> Result<(ContentChunk<BS>, Self::RootRef)>;
    fn extract_root(buffer: &[u8]) -> Result<Self::RootRef>;
}
Expand description

Splitter-side chunk mode operations (extends JoinMode).

Required Associated Types§

Source

type RefBytes: AsRef<[u8]> + AsMut<[u8]> + Clone + Debug + Send + Sync

Fixed-size byte array for a reference: [u8; 32] or [u8; 64].

Required Methods§

Source

fn prepare_chunk<const BS: usize>( data: Vec<u8>, ) -> Result<(ContentChunk<BS>, Self::RefBytes)>

Prepare chunk data (span + body), returning chunk and reference bytes. Takes ownership of the payload to avoid an extra allocation.

Source

fn empty_chunk<const BS: usize>() -> Result<(ContentChunk<BS>, Self::RootRef)>

Produce the chunk for an empty file, returning it and the root ref.

Source

fn extract_root(buffer: &[u8]) -> Result<Self::RootRef>

Extract root reference from top of buffer.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl SplitMode for EncryptedMode

Available on crate feature encryption only.
Source§

impl SplitMode for PlainMode