Skip to main content

Writer

Struct Writer 

Source
pub struct Writer { /* private fields */ }

Implementations§

Source§

impl Writer

Source

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).

Source

pub fn set_zstd_level(&mut self, level: i32)

zstd level for chunk storage/wire compression (default 3).

Source

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().

Source

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.

Source

pub fn add_track(&mut self, track: TrackRecord) -> Result<()>

Source

pub fn add_segment(&mut self, segment: SegmentRecord) -> Result<()>

Source

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…).

Source

pub fn set_meta(&mut self, key: &str, value: &str)

Source

pub fn chunk_count(&self) -> u32

Source

pub fn finish(self) -> Result<PackStats>

Write all tables, the section directory and the final superblock.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.