pub struct EmbedManifest {
pub version: u32,
pub repo_path: String,
pub commit_hash: Option<String>,
pub updated_at: Option<u64>,
pub settings: EmbedSettings,
pub chunks: BTreeMap<String, ManifestEntry>,
pub checksum: Option<String>,
}Expand description
Manifest tracking all chunks for incremental updates
§Determinism Note
The manifest binary file is not byte-deterministic across saves due to the
updated_at timestamp. However, the checksum is deterministic because it
excludes the timestamp from its calculation.
For comparing manifests:
- Wrong: Compare raw binary files (will differ due to timestamp)
- Right: Compare checksums via
manifest.checksum(deterministic)
This design allows incremental updates while still detecting actual content changes.
§CI/CD Integration
If you need byte-deterministic manifests (e.g., for Docker layer caching):
- Compare checksums instead of file hashes
- Or set
updated_at = Nonebefore saving in test environments
Fields§
§version: u32Manifest format version
repo_path: StringRelative repository path (from git root or CWD)
commit_hash: Option<String>Git commit hash when manifest was created (for reference only) Note: We always serialize Option fields for bincode compatibility
updated_at: Option<u64>Timestamp of last update (Unix seconds)
Important: This field is excluded from the integrity checksum calculation to allow the checksum to remain stable across re-saves of unchanged content. The binary file will differ byte-for-byte on each save, but the checksum will only change if actual chunk content changes.
settings: EmbedSettingsSettings used to generate chunks (part of integrity)
chunks: BTreeMap<String, ManifestEntry>All chunks indexed by location key Using BTreeMap for deterministic iteration order (critical for cross-platform consistency)
checksum: Option<String>Integrity checksum (BLAKE3 of settings + sorted chunk entries) Excluded from serialization, computed on save, verified on load
Implementations§
Source§impl EmbedManifest
impl EmbedManifest
Sourcepub fn new(repo_path: String, settings: EmbedSettings) -> Self
pub fn new(repo_path: String, settings: EmbedSettings) -> Self
Create a new empty manifest
Sourcepub fn location_key(file: &str, symbol: &str, kind: ChunkKind) -> String
pub fn location_key(file: &str, symbol: &str, kind: ChunkKind) -> String
Generate deterministic location key for a chunk
Format: file::symbol::kind
Uses :: as separator (unlikely in paths/symbols)
Sourcepub fn save(&mut self, path: &Path) -> Result<(), EmbedError>
pub fn save(&mut self, path: &Path) -> Result<(), EmbedError>
Save manifest to file with integrity checksum
§Behavior
This method:
- Updates
updated_atto the current timestamp - Computes a new checksum (excluding timestamp)
- Serializes to bincode format
§Determinism
The resulting binary file is not byte-deterministic because the timestamp changes on every save. However, the checksum is deterministic - it only changes when actual chunk content or settings change.
For deterministic testing, set self.updated_at = None before saving.
§Note
This method mutates self to set checksum and timestamp.
This avoids cloning the entire manifest (which can be large).
Sourcepub fn load(path: &Path) -> Result<Self, EmbedError>
pub fn load(path: &Path) -> Result<Self, EmbedError>
Load manifest from file with integrity verification
Sourcepub fn load_if_exists(path: &Path) -> Result<Option<Self>, EmbedError>
pub fn load_if_exists(path: &Path) -> Result<Option<Self>, EmbedError>
Load manifest if it exists, otherwise return None
Sourcepub fn update(&mut self, chunks: &[EmbedChunk]) -> Result<(), EmbedError>
pub fn update(&mut self, chunks: &[EmbedChunk]) -> Result<(), EmbedError>
Update manifest with current chunks, detecting collisions
Sourcepub fn diff(&self, current_chunks: &[EmbedChunk]) -> EmbedDiff
pub fn diff(&self, current_chunks: &[EmbedChunk]) -> EmbedDiff
Compute diff between current chunks and manifest
Sourcepub fn settings_match(&self, settings: &EmbedSettings) -> bool
pub fn settings_match(&self, settings: &EmbedSettings) -> bool
Check if settings match the manifest settings
Sourcepub fn chunk_count(&self) -> usize
pub fn chunk_count(&self) -> usize
Get the number of chunks in the manifest
Trait Implementations§
Source§impl Clone for EmbedManifest
impl Clone for EmbedManifest
Source§fn clone(&self) -> EmbedManifest
fn clone(&self) -> EmbedManifest
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for EmbedManifest
impl Debug for EmbedManifest
Source§impl<'de> Deserialize<'de> for EmbedManifest
impl<'de> Deserialize<'de> for EmbedManifest
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for EmbedManifest
impl RefUnwindSafe for EmbedManifest
impl Send for EmbedManifest
impl Sync for EmbedManifest
impl Unpin for EmbedManifest
impl UnwindSafe for EmbedManifest
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> 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>
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 moreSource§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
Source§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();Source§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
Source§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
Source§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
Source§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
Source§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
Source§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
Source§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
Source§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
Source§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();Source§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
Source§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
Source§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
Source§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
Source§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
Source§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
Source§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
Source§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
Source§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
Source§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
Source§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling Attribute value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();Source§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
Source§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi Quirk value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();Source§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.Source§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the Condition value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);