Skip to main content

Format

Trait Format 

Source
pub trait Format: Send {
    // Required methods
    fn name(&self) -> &'static str;
    fn chunks<'a>(&'a self) -> Box<dyn Iterator<Item = Chunk<'a>> + 'a>;
    fn apply(&mut self, hits: &[Hit]) -> Result<()>;
    fn to_bytes(&self) -> Result<Vec<u8>>;
}
Expand description

A handler for one specific capture-file format.

The trait is intentionally dyn-compatible: no Self: Sized methods, no associated constants. Construction is done via free fn pointers on a Handler so the Dispatcher can route based on file head bytes.

Required Methods§

Source

fn name(&self) -> &'static str

Short human-readable name of the format (e.g. "perf", "tar").

Source

fn chunks<'a>(&'a self) -> Box<dyn Iterator<Item = Chunk<'a>> + 'a>

Iterate scannable chunks for the detection engine.

Source

fn apply(&mut self, hits: &[Hit]) -> Result<()>

Apply redactions in place. The implementation chooses whether each Hit can be satisfied with Replacement::ZeroFill alone or whether structural updates (offsets, checksums, child-format repackaging) are also needed.

Source

fn to_bytes(&self) -> Result<Vec<u8>>

Serialize the (possibly-scrubbed) file to an in-memory byte vector. Used by container formats (tar, zip, nsys) to repackage child members without going through a temp file.

Implementors§