pub struct ItemRef {
pub logical_path: String,
pub is_dir: bool,
pub content_hash: Option<String>,
pub size: Option<u64>,
pub media_type: Option<String>,
pub handle: String,
}Expand description
Metadata-only view of one side of a comparison. Carries logical identity
and content metadata but NOT a filesystem path — data access goes through
DataAccess.
§Metadata invariants
content_hash, size, and media_type are opportunistic hints.
Producers (expanding comparators like directory/zip, or data backends)
populate them when doing so is cheap — typically as a byproduct of work
they were already performing. Consumers must not assume presence, but
may trust presence: when a field is set, the value accurately reflects
the current bytes. Use ItemRef::resolve_hash / ItemRef::resolve_size
to obtain a value with a transparent fall-back read.
This keeps fast paths (directory-only listings, short-circuit identical detection) cheap while letting consumers that need a value — most notably the move detector, which correlates leaves across container boundaries — hydrate on demand.
Fields§
§logical_path: String§is_dir: bool§content_hash: Option<String>§size: Option<u64>§media_type: Option<String>§handle: StringOpaque identifier used by DataAccess implementations to locate data. Plugin authors should not create or interpret this value directly.
Implementations§
Source§impl ItemRef
impl ItemRef
pub fn extension(&self) -> Option<String>
Sourcepub fn resolve_hash(&self, data: &dyn DataAccess) -> BinocResult<String>
pub fn resolve_hash(&self, data: &dyn DataAccess) -> BinocResult<String>
Return the item’s BLAKE3 content hash, computing it from bytes if
not already cached on this ItemRef. Never valid for directories.
Sourcepub fn resolve_size(&self, data: &dyn DataAccess) -> BinocResult<u64>
pub fn resolve_size(&self, data: &dyn DataAccess) -> BinocResult<u64>
Return the item’s byte length, reading from the backend if not already
cached on this ItemRef. Never valid for directories.