pub struct Writer { /* private fields */ }Implementations§
Source§impl Writer
impl Writer
Sourcepub fn create(
path: &Path,
asset_uuid: [u8; 16],
timescale: u32,
compress: bool,
) -> Result<Self>
pub fn create( path: &Path, asset_uuid: [u8; 16], timescale: u32, compress: bool, ) -> Result<Self>
Create a new CAVS-1 file at path. compress enables per-chunk zstd
(chunks that don’t shrink are stored raw regardless).
Sourcepub fn set_zstd_level(&mut self, level: i32)
pub fn set_zstd_level(&mut self, level: i32)
zstd level for chunk storage/wire compression (default 3).
Sourcepub fn sign_with(&mut self, secret: &[u8; 32])
pub fn sign_with(&mut self, secret: &[u8; 32])
Sign the packed content with this Ed25519 secret key. The signature
(over the canonical content message, see
cavs_hash::content_signature_message) and the public key are
embedded as sig.ed25519 / sig.pubkey meta entries at finish().
Sourcepub fn add_chunks_parallel(
&mut self,
data: &[u8],
ranges: &[Range<usize>],
) -> Result<Vec<u32>>
pub fn add_chunks_parallel( &mut self, data: &[u8], ranges: &[Range<usize>], ) -> Result<Vec<u32>>
Add a batch of chunk payloads given as byte ranges of data,
preparing the expensive per-chunk work (BLAKE3 identity + zstd
compression) on all cores. Ingest order, dedup decisions and the
stored byte stream are exactly those of calling Writer::add_chunk
on each range in order — the resulting file is byte-identical; only
wall-clock changes (3–7× faster on real payloads, more at high zstd
levels).
Sourcepub fn add_chunk(&mut self, raw: &[u8]) -> Result<u32>
pub fn add_chunk(&mut self, raw: &[u8]) -> Result<u32>
Add one chunk payload. Returns its chunk-table index. Duplicate payloads (same BLAKE3) are not stored again.
pub fn add_track(&mut self, track: TrackRecord) -> Result<()>
pub fn add_segment(&mut self, segment: SegmentRecord) -> Result<()>
Sourcepub fn pin_dict(&mut self, chunk_index: u32) -> Result<()>
pub fn pin_dict(&mut self, chunk_index: u32) -> Result<()>
Mark a chunk as part of the global dictionary (privileged reuse: init segments, bootstrap assets, shared headers…).
pub fn set_meta(&mut self, key: &str, value: &str)
pub fn chunk_count(&self) -> u32
Auto Trait Implementations§
impl Freeze for Writer
impl RefUnwindSafe for Writer
impl Send for Writer
impl Sync for Writer
impl Unpin for Writer
impl UnsafeUnpin for Writer
impl UnwindSafe for Writer
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
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