pub enum Key {
U64(u64),
Uuid(u128),
Str(Arc<str>),
Pair(u64, u64),
}Expand description
One element’s key: what its paths, its Keyed slot, and (under persistence) its stored
row are addressed by.
A u64 key is its own path handle, with no interner, lock or allocation: exactly the cost
integer keys always had. The wide forms (Uuid, Str, Pair) intern process-globally to
a u64 handle on first use, so paths stay 12 bytes and every collection index stays
u64-keyed. A handle, once minted, is stable for the process’s lifetime (undo records
and long-lived ModelIds rely on that) and reverses through Key::of_handle; the
interner’s size is observable via interned_keys.
Variants§
U64(u64)
Uuid(u128)
A UUID, carried as its raw 128 bits (uuid::Uuid::as_u128).
Str(Arc<str>)
A natural string key: a slug, an external system’s id.
Pair(u64, u64)
Two handles as one key: how the persistence layer addresses join rows. Apps rarely construct one directly.
Implementations§
Source§impl Key
impl Key
Sourcepub fn handle(&self) -> u64
pub fn handle(&self) -> u64
The key’s path handle: identity for U64, interned (once, then a read-locked lookup)
for the wide forms. Callable from any thread; the interner is process-global.
Sourcepub fn of_handle(handle: u64) -> Option<Key>
pub fn of_handle(handle: u64) -> Option<Key>
The key a handle names: identity below the wide floor, the interner’s record above
it. None only for a wide handle nothing ever interned (a forged value).
pub fn as_u64(&self) -> Option<u64>
pub fn as_uuid(&self) -> Option<Uuid>
pub fn as_str(&self) -> Option<&str>
Trait Implementations§
impl Eq for Key
impl StructuralPartialEq for Key
Auto Trait Implementations§
impl Freeze for Key
impl RefUnwindSafe for Key
impl Send for Key
impl Sync for Key
impl Unpin for Key
impl UnsafeUnpin for Key
impl UnwindSafe for Key
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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<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.impl<T> ErasedDestructor for Twhere
T: 'static,
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 more