Skip to main content

HashSetData

Struct HashSetData 

Source
pub struct HashSetData {
    pub keys: Arc<Vec<Arc<String>>>,
    pub index: HashMap<u64, Vec<u32>>,
}
Expand description

HashSet storage — one keyspace, no values. Mirror of HashMapData with the values buffer dropped.

ADR-006 §2.7.15 / Q16 amendment (mirror of §2.7.9 FilterExpr / §2.7.13 Reference precedent for the cardinality-amendment shape, but Set is a HashMap sibling — full HeapValue::HashSet arm rather than pure-discriminator). Reuses the Stage C P1(b) Phase 2d Array shape (TypedBuffer<Arc<String>>) for the keys buffer verbatim. Insertion order is the canonical storage; the index is a sidecar acceleration structure for O(1) set.has(key).

String-only keyspace at landing (per the W9-set-methods owner audit’s Path A scope and the §2.7.15 Q16 ruling). Heterogeneous- element keysets (int-keyed, TypedObject-keyed) are explicitly out-of-scope; the Path B (TypedSet<T> per element kind) rebuild is a future Phase-2c amendment with measurement.

Fields§

§keys: Arc<Vec<Arc<String>>>

Insertion-ordered keys (string-typed buffer).

Storage shape: Arc<Vec<Arc<String>>> post-V3-S5 ckpt-5-prime²a (Migration shape (a) per supervisor 2026-05-15 ratification — TypedBuffer<T> wrapper layer retired wholesale at ckpt-4; Arc<Vec<T>> is the smallest delta preserving Arc::make_mut clone-on-write semantics).

§index: HashMap<u64, Vec<u32>>

Eager bucket-index: hash → list of indices into keys array. Enables O(1) lookup at set.has(key). Hash is FNV-1a over the key string bytes — same as HashMapData::index.

Implementations§

Source§

impl HashSetData

Source

pub fn new() -> Self

Build an empty HashSetData with no entries.

Source

pub fn from_keys(keys: Vec<Arc<String>>) -> Self

Build from a Vec<Arc<String>> of keys, computing the bucket index eagerly. Duplicate keys in the input are collapsed (insertion-order preserved, first occurrence wins).

Source

pub fn len(&self) -> usize

Number of entries.

Source

pub fn is_empty(&self) -> bool

Whether the set is empty.

Source

pub fn contains(&self, key: &str) -> bool

Whether the set contains the given key. O(1) via the bucket index plus a short bucket scan for collision disambiguation.

Source

pub fn insert(&mut self, key: Arc<String>) -> bool

Insert a key. Returns true if the key was newly added, false if it was already present (no-op in the latter case).

Source

pub fn remove(&mut self, key: &str) -> bool

Remove the entry under key. Returns true if the key was present (and removed), false if no entry existed. The bucket index is updated to reflect the buffer’s post-removal indices: every entry after the removed slot shifts down by one position (mirror of HashMapData::remove).

Trait Implementations§

Source§

impl Clone for HashSetData

Source§

fn clone(&self) -> Self

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 HashSetData

Source§

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

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

impl Default for HashSetData

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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<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> 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 = 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.
Source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,