pub struct CompactBinaryUsri {
pub path_and_realm: u64,
pub level_and_depth: u16,
pub anchor_hash: u64,
}Expand description
Compact Binary USRI — 16-byte fixed-size (OCS §13.2).
Fields§
§path_and_realm: u64Bytes [0..7]: 56-bit path hash + 8-bit realm class
level_and_depth: u16Bytes [8..9]: 16-bit hierarchy level + nesting depth
anchor_hash: u64Bytes [10..15]: 48-bit anchor hash (stored as u64, upper 16 bits unused)
Implementations§
Source§impl CompactBinaryUsri
impl CompactBinaryUsri
Sourcepub fn new(
realm_class: RealmClass,
path_hash: u64,
level: HierarchyLevel,
nesting_depth: u8,
anchor_hash: u64,
) -> Self
pub fn new( realm_class: RealmClass, path_hash: u64, level: HierarchyLevel, nesting_depth: u8, anchor_hash: u64, ) -> Self
Build a CB-USRI from components.
Sourcepub fn realm_class(&self) -> u8
pub fn realm_class(&self) -> u8
Extract the realm class.
Sourcepub fn nesting_depth(&self) -> u8
pub fn nesting_depth(&self) -> u8
Extract the nesting depth.
Sourcepub fn anchor_hash_48(&self) -> u64
pub fn anchor_hash_48(&self) -> u64
Extract the 48-bit anchor hash.
Sourcepub fn from_bytes(bytes: &[u8; 16]) -> Self
pub fn from_bytes(bytes: &[u8; 16]) -> Self
Decode from 16 bytes.
Sourcepub fn from_usri(
usri_str: &str,
realm_class: RealmClass,
level: HierarchyLevel,
nesting_depth: u8,
anchor: &str,
) -> Self
pub fn from_usri( usri_str: &str, realm_class: RealmClass, level: HierarchyLevel, nesting_depth: u8, anchor: &str, ) -> Self
Compute from a USRI string and level/depth/anchor info.
Sourcepub fn to_quin_context_token(&self) -> u64
pub fn to_quin_context_token(&self) -> u64
Deterministically fold the 16-byte CompactBinaryUsri (path_and_realm,
level_and_depth, anchor_hash) into a zero-heap 60-bit token (MSB = 0,
distinct from did:q42 topological pointers, with 56-bit scoped realm hash in
bits [0..55] and SENSITIVITY_PUBLIC = 0 in bits [56..63]) for NQuin.context.
Sourcepub fn to_quin_context_with_sensitivity(&self, sensitivity: u8) -> u64
pub fn to_quin_context_with_sensitivity(&self, sensitivity: u8) -> u64
Encode an NQuin.context word combining an 8-bit sensitivity class in [56..63]
with the 56-bit folded CB-USRI token in [0..55].
Trait Implementations§
Source§impl Clone for CompactBinaryUsri
impl Clone for CompactBinaryUsri
impl Copy for CompactBinaryUsri
Source§impl Debug for CompactBinaryUsri
impl Debug for CompactBinaryUsri
impl Eq for CompactBinaryUsri
Source§impl Hash for CompactBinaryUsri
impl Hash for CompactBinaryUsri
Source§impl PartialEq for CompactBinaryUsri
impl PartialEq for CompactBinaryUsri
impl StructuralPartialEq for CompactBinaryUsri
Auto Trait Implementations§
impl Freeze for CompactBinaryUsri
impl RefUnwindSafe for CompactBinaryUsri
impl Send for CompactBinaryUsri
impl Sync for CompactBinaryUsri
impl Unpin for CompactBinaryUsri
impl UnsafeUnpin for CompactBinaryUsri
impl UnwindSafe for CompactBinaryUsri
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.