pub struct StorageKey(/* private fields */);Expand description
The redb key a document row is stored under.
Fixed-width lowercase hex, so lexicographic order matches surrogate order and a range scan iterates rows in surrogate order with no extra index. Internal: a storage key never reaches a client.
Implementations§
Source§impl StorageKey
impl StorageKey
Sourcepub fn for_surrogate(surrogate: Surrogate) -> Self
pub fn for_surrogate(surrogate: Surrogate) -> Self
Wrap surrogate as the key it is stored under. Allocation-free: the
hex text is a rendering, produced only by Display or to_identity.
Sourcepub fn parse(key: &str) -> Option<Self>
pub fn parse(key: &str) -> Option<Self>
Parse a redb key back into a StorageKey.
Returns None unless key is exactly 8 lowercase hex characters.
This handles legacy non-surrogate document IDs gracefully: a value
that fails to parse is not a minted storage key. Allocation-free.
Sourcepub fn surrogate(&self) -> Surrogate
pub fn surrogate(&self) -> Surrogate
Recover the surrogate this key encodes. Infallible and free: the surrogate IS the key, not something re-derived from stored text.
Sourcepub fn to_identity(&self) -> RowIdentity
pub fn to_identity(&self) -> RowIdentity
The client-visible identity of the row stored under this key.
Allocates the decimal string — unavoidable, since a client never sees the hex encoding.
Trait Implementations§
Source§impl Clone for StorageKey
impl Clone for StorageKey
impl Copy for StorageKey
Source§impl Debug for StorageKey
impl Debug for StorageKey
Source§impl Display for StorageKey
impl Display for StorageKey
impl Eq for StorageKey
Source§impl Hash for StorageKey
impl Hash for StorageKey
Source§impl Ord for StorageKey
impl Ord for StorageKey
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialEq for StorageKey
impl PartialEq for StorageKey
Source§impl PartialOrd for StorageKey
impl PartialOrd for StorageKey
impl StructuralPartialEq for StorageKey
Auto Trait Implementations§
impl Freeze for StorageKey
impl RefUnwindSafe for StorageKey
impl Send for StorageKey
impl Sync for StorageKey
impl Unpin for StorageKey
impl UnsafeUnpin for StorageKey
impl UnwindSafe for StorageKey
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
out indicating that a T is niched.impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
impl<T> Scalar for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.