Skip to main content

UmbraPointer

Struct UmbraPointer 

Source
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>

Source

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).

Source

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.

Source

pub const fn prefix(&self) -> u32

Source

pub const fn as_raw(&self) -> *const T

Source

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).

Source

pub const fn matches_prefix(&self, query: u32) -> bool

Compare against a literal query prefix.

Source§

impl<T> UmbraPointer<T>

Source

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.

Source

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.

Source

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.

Source

pub unsafe fn deref_unchecked(&self) -> &T

§Safety

Caller must guarantee the target is still live.

Trait Implementations§

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.