pub struct HmcWriter { /* private fields */ }Expand description
Builder that accumulates assets in memory and writes a .hmc zip in one shot.
Kept in-memory because individual documents are small relative to RAM and a single atomic write avoids half-written containers on crash/interrupt.
Implementations§
Source§impl HmcWriter
impl HmcWriter
Sourcepub fn new(source: SourceInfo, source_bytes: &[u8]) -> Self
pub fn new(source: SourceInfo, source_bytes: &[u8]) -> Self
Start a container from the (already-hashed) source description and bytes.
Sourcepub fn add_derived(
&mut self,
kind: AssetKind,
name: &str,
mime: &str,
bytes: Vec<u8>,
) -> String
pub fn add_derived( &mut self, kind: AssetKind, name: &str, mime: &str, bytes: Vec<u8>, ) -> String
Add a derived asset under its conventional directory using name
(e.g. document.html). Returns the in-zip path.
Sourcepub fn manifest_mut(&mut self) -> &mut HmcManifest
pub fn manifest_mut(&mut self) -> &mut HmcManifest
Mutable access to the manifest to set pipeline/status/tags before finalize.
Sourcepub fn write_to_dir(&self, dir: &Path) -> Result<PathBuf>
pub fn write_to_dir(&self, dir: &Path) -> Result<PathBuf>
Write the container to dir/<doc_id>.hmc and return the path.
Sourcepub fn manifest(&self) -> &HmcManifest
pub fn manifest(&self) -> &HmcManifest
Manifest.
Auto Trait Implementations§
impl Freeze for HmcWriter
impl RefUnwindSafe for HmcWriter
impl Send for HmcWriter
impl Sync for HmcWriter
impl Unpin for HmcWriter
impl UnsafeUnpin for HmcWriter
impl UnwindSafe for HmcWriter
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
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