pub struct UmbraPointer<T> { /* private fields */ }Expand description
16-byte content-prefixed pointer. Layout is fixed so SIMD scans
over an array of UmbraPointer<T> see consistent prefix-byte
positions.
Implementations§
Source§impl<T> UmbraPointer<T>
impl<T> UmbraPointer<T>
Sourcepub const SIGNATURE: AxisMask
pub const SIGNATURE: AxisMask
Direction signature of UmbraPointer<T>. Engages the
K_content_prefix axis (4-byte prefix stored at slot for
short-circuit equality before deref).
Sourcepub const unsafe fn from_raw(prefix: u32, target: *const T) -> Self
pub const unsafe fn from_raw(prefix: u32, target: *const T) -> Self
Construct from an existing raw pointer with an explicit prefix. The caller is responsible for keeping the pointee alive.
§Safety
target must remain valid for the lifetime of this
UmbraPointer. prefix should be a deterministic function of
the pointee’s content; otherwise prefix comparisons are
meaningless.
pub const fn prefix(&self) -> u32
pub const fn as_raw(&self) -> *const T
Sourcepub const fn prefix_eq(&self, other: &Self) -> bool
pub const fn prefix_eq(&self, other: &Self) -> bool
Compare prefixes only. Single in-register equality check; no
dereference of target. Returns true when prefixes are equal,
false when they differ. Use this as the first step in a staged
equality check (Umbra paper’s prefix short-circuit).
Sourcepub const fn matches_prefix(&self, query: u32) -> bool
pub const fn matches_prefix(&self, query: u32) -> bool
Compare against a literal query prefix.
Source§impl<T> UmbraPointer<T>
impl<T> UmbraPointer<T>
Sourcepub fn with_content_prefix(value: T) -> Box<UmbraOwner<T>>
pub fn with_content_prefix(value: T) -> Box<UmbraOwner<T>>
Build by moving value onto the heap and copying its first
4 bytes (in declaration order) as the prefix.
Useful for types whose first 4 bytes are a meaningful key
field (database row IDs, packet headers, etc.). For more
general use, prefer UmbraPointer::with_hash_prefix.
Sourcepub fn with_hash_prefix(value: T) -> Box<UmbraOwner<T>>where
T: Hash,
pub fn with_hash_prefix(value: T) -> Box<UmbraOwner<T>>where
T: Hash,
Build by moving value onto the heap and hashing its byte
representation as the prefix. Near-perfect rejection rate
because hash distribution is approximately random over u32.
Sourcepub fn from_arc(value: Arc<T>, prefix: u32) -> ArcUmbra<T>
pub fn from_arc(value: Arc<T>, prefix: u32) -> ArcUmbra<T>
Wrap an Arc<T> without taking ownership of the heap
allocation. Uses hash-based prefix.
Sourcepub unsafe fn deref_unchecked(&self) -> &T
pub unsafe fn deref_unchecked(&self) -> &T
§Safety
Caller must guarantee the target is still live.