pub struct ChunkFormat {
pub nonce: [u8; 12],
pub data_length: u32,
pub payload: Vec<u8>,
}Expand description
Format for individual chunks in the file
Fields§
§nonce: [u8; 12]Encryption nonce (12 bytes for AES-GCM) Contains actual nonce when encrypted, zeros ([0u8; 12]) when not encrypted
data_length: u32Length of payload data
payload: Vec<u8>Chunk payload data (may be raw, compressed, encrypted, or any
combination) Note: Previously named encrypted_data but renamed for
clarity since this field contains data in various states of
transformation
Implementations§
Source§impl ChunkFormat
impl ChunkFormat
Sourcepub fn to_bytes(&self) -> Vec<u8> ⓘ
pub fn to_bytes(&self) -> Vec<u8> ⓘ
Serializes chunk to binary format
Format: [NONCE][DATA_LENGTH][PAYLOAD]
Sourcepub fn to_bytes_with_size(&self) -> (Vec<u8>, u64)
pub fn to_bytes_with_size(&self) -> (Vec<u8>, u64)
Sourcepub fn from_bytes(data: &[u8]) -> Result<(Self, usize), PipelineError>
pub fn from_bytes(data: &[u8]) -> Result<(Self, usize), PipelineError>
Deserializes chunk from binary format Returns (chunk, bytes_consumed)
Sourcepub fn validate(&self) -> Result<(), PipelineError>
pub fn validate(&self) -> Result<(), PipelineError>
Validates the chunk format
Trait Implementations§
Source§impl Clone for ChunkFormat
impl Clone for ChunkFormat
Source§fn clone(&self) -> ChunkFormat
fn clone(&self) -> ChunkFormat
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ChunkFormat
impl Debug for ChunkFormat
Source§impl PartialEq for ChunkFormat
impl PartialEq for ChunkFormat
impl StructuralPartialEq for ChunkFormat
Auto Trait Implementations§
impl Freeze for ChunkFormat
impl RefUnwindSafe for ChunkFormat
impl Send for ChunkFormat
impl Sync for ChunkFormat
impl Unpin for ChunkFormat
impl UnwindSafe for ChunkFormat
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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