pub struct ContentHandle {
pub repo: String,
pub epoch: String,
pub kind: HandleKind,
pub key: String,
pub content_hash: String,
}Expand description
Deterministic, epoch-scoped content identifier.
Format (not locked against future collision/freshness changes):
scc://{repo}/{epoch}/{kind}/{encoded_key}@{content_hash16}
encoded_key is percent-encoded so paths and :: scopes stay portable
across MCP calls. content_hash16 is FNV-1a-64 of the referent file
bytes (hex); empty hash means identity-only (no freshness gate).
Fields§
§repo: String§epoch: String§kind: HandleKind§key: String§content_hash: String16-char hex FNV-1a of file bytes; empty if unknown.
Implementations§
Source§impl ContentHandle
impl ContentHandle
pub fn new( repo: impl Into<String>, epoch: impl Into<String>, kind: HandleKind, key: impl Into<String>, content_hash: impl Into<String>, ) -> Self
Sourcepub fn for_symbol(
repo: &str,
epoch: &str,
path: &str,
name: &str,
content_hash: &str,
) -> Self
pub fn for_symbol( repo: &str, epoch: &str, path: &str, name: &str, content_hash: &str, ) -> Self
Symbol handle: path::qualified_name (never basename-only).
pub fn for_file(repo: &str, epoch: &str, path: &str, content_hash: &str) -> Self
pub fn for_span( repo: &str, epoch: &str, path: &str, start_line: u32, end_line: u32, content_hash: &str, ) -> Self
pub fn parse(s: &str) -> Result<Self, HandleError>
Sourcepub fn matches_content(&self, actual_hash: &str) -> bool
pub fn matches_content(&self, actual_hash: &str) -> bool
True when actual_hash matches the handle’s freshness pin.
Identity-only handles (empty hash) never fail this check.
pub fn refuse_if_stale(&self, actual_hash: &str) -> Result<(), HandleError>
Trait Implementations§
Source§impl Clone for ContentHandle
impl Clone for ContentHandle
Source§impl Debug for ContentHandle
impl Debug for ContentHandle
Source§impl<'de> Deserialize<'de> for ContentHandle
impl<'de> Deserialize<'de> for ContentHandle
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Display for ContentHandle
impl Display for ContentHandle
impl Eq for ContentHandle
Source§impl Hash for ContentHandle
impl Hash for ContentHandle
Source§impl PartialEq for ContentHandle
impl PartialEq for ContentHandle
Source§impl Serialize for ContentHandle
impl Serialize for ContentHandle
impl StructuralPartialEq for ContentHandle
Auto Trait Implementations§
impl Freeze for ContentHandle
impl RefUnwindSafe for ContentHandle
impl Send for ContentHandle
impl Sync for ContentHandle
impl Unpin for ContentHandle
impl UnsafeUnpin for ContentHandle
impl UnwindSafe for ContentHandle
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