pub struct EntityId(pub [u8; 16]);Expand description
Deterministic 16-byte content-hash identifier per D-06.
EntityId = blake3(canonical_name_normalized || "::" || entity_type)[..16]Where canonical_name_normalized is:
- lowercase
- trim leading + trailing whitespace
- collapse internal runs of whitespace to a single space
- drop trailing punctuation
.,;:!?
16 bytes = 128 bits of entropy — collision probability ≈ 2^-64 for ~1B entities (birthday bound). Cross-Episode disambiguation (e.g., “Alice” in Episode A vs “Alice Smith” in Episode B referring to the same person) is D-09 deferred to the Phase 4 Verifier; v0 keeps them as distinct EntityIds — the conservative default per blueprint §5.2 “graph default-off”.
Display renders the lowercase hex; useful for tracing logs and Cypher
WHERE n.id = '...' literals.
Tuple Fields§
§0: [u8; 16]Implementations§
Source§impl EntityId
impl EntityId
Sourcepub fn from_name_and_type(name: &str, entity_type: &str) -> EntityId
pub fn from_name_and_type(name: &str, entity_type: &str) -> EntityId
Derive a deterministic EntityId from (name, entity_type).
See struct rustdoc for the canonicalization steps. The output is byte-
identical across calls for the same input (proven by
entity_id_is_deterministic test) and treats ("Alice Smith. ", "Person") and ("alice smith", "Person") as the same id (proven by
entity_id_normalizes_whitespace_and_punctuation test). The
entity_type is appended verbatim (no normalization) so ("Alice", "Person") and ("Alice", "Place") stay distinct (proven by
entity_id_distinguishes_by_type test).
Sourcepub fn from_hex(s: &str) -> Option<EntityId>
pub fn from_hex(s: &str) -> Option<EntityId>
Decode an EntityId from its 32-char lowercase-hex Display form.
Returns None if s is not exactly 32 ASCII hex chars. This is the
inverse of Display and is the round-trip path used by Graph::anchored
to map the Cypher-emitted source_entity_id (rendered with the same
format!("{}", id) shape on the write path) back to the seed key
for confidence lookups.
Trait Implementations§
impl Copy for EntityId
Source§impl<'de> Deserialize<'de> for EntityId
impl<'de> Deserialize<'de> for EntityId
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<EntityId, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<EntityId, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Eq for EntityId
Source§impl Serialize for EntityId
impl Serialize for EntityId
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for EntityId
Auto Trait Implementations§
impl Freeze for EntityId
impl RefUnwindSafe for EntityId
impl Send for EntityId
impl Sync for EntityId
impl Unpin for EntityId
impl UnsafeUnpin for EntityId
impl UnwindSafe for EntityId
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,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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> Pointable for T
impl<T> Pointable for T
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> ToCompactString for Twhere
T: Display,
impl<T> ToCompactString for Twhere
T: Display,
Source§fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
fn try_to_compact_string(&self) -> Result<CompactString, ToCompactStringError>
ToCompactString::to_compact_string() Read moreSource§fn to_compact_string(&self) -> CompactString
fn to_compact_string(&self) -> CompactString
CompactString. Read moreSource§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
Source§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.