Skip to main content

GeometricSignature

Struct GeometricSignature 

Source
pub struct GeometricSignature { /* private fields */ }
Expand description

A geometric signature for a node in hyperbolic space.

This signature uniquely identifies a point or region in the hyperbolic space, enabling O(1) lookups.

Implementations§

Source§

impl GeometricSignature

Source

pub fn new(hash: String, level: u32, position_signature: Vec<i32>) -> Self

Create a new geometric signature.

Source

pub fn hash(&self) -> &str

Get the hash value.

Source

pub fn level(&self) -> u32

Get the tree level.

Source

pub fn position_signature(&self) -> &[i32]

Get the position signature.

Source

pub fn stub(unique_id: &str) -> Self

Create a stub signature for data-only nodes (no geometric meaning).

Source

pub fn is_stub(&self) -> bool

Whether this is a stub signature (a data-only node with no geometric embedding — upgradeable via embed_existing).

Source

pub fn unique_id(&self) -> String

Get a unique node identifier, derived from level and position alone.

Deliberately independent of the spatial index. This digest used to include hash() — the geometric bucket — which made every node’s identity a function of which bucket the index happened to choose, so the index could not be changed without renaming every node. The bucket hash is itself a function of the same position (it is the signature of the containing bucket’s centre), so it contributed no entropy: two nodes sharing a level and a position_signature already shared a bucket. Dropping it loses no discrimination and buys a swappable index.

Uniqueness rests on position_signature, quantised at 2^-20 — the resolution the hardening audit established (quantize_1000 collided for depth-2 cousins at a few hundred nodes; 2^-20 pushes the birthday bound past millions).

For stub signatures (data-only nodes), returns the hash directly.

Source§

impl GeometricSignature

Source

pub fn embedded(point: &HyperbolicPoint, dimension: usize, level: u32) -> Self

Create the signature of an embedded node at point, level deep.

The position signature is the point’s first dimension coordinates quantised at 2^-20; hash is set to the resulting unique_id, so for an embedded signature the two agree. No index is consulted: this is a pure function of position and depth.

Trait Implementations§

Source§

impl Clone for GeometricSignature

Source§

fn clone(&self) -> GeometricSignature

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GeometricSignature

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for GeometricSignature

Source§

impl Hash for GeometricSignature

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for GeometricSignature

Source§

fn eq(&self, other: &GeometricSignature) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for GeometricSignature

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

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.