set
Hash Set (Set
Functions
| Function | Description |
|---|---|
set_pages_for | |
set_new | Create a new set with given capacity (rounded up to power of 2, min 16). |
set_hash | Internal: hash function for i64. |
set_rehash | Internal: rehash when load factor > 0.7. |
set_add | Insert a value into the set. |
set_has | Check if value is in the set. |
set_del | Remove a value from the set. Returns 1 if found, 0 otherwise. |
set_len | Number of elements. |
set_clear | Remove all elements. |
set_union | Union: returns new set containing all elements from a and b. |
set_intersect | Intersection: returns new set of elements in both a and b. |
set_diff | Difference: returns new set of elements in a but not in b. |
set_subset | Subset: returns 1 if all elements of a are in b. |
set_eq | Equality: same elements in both sets. |
set_to_vec | Convert set to vec (unordered). |
Details
set_pages_for
fn set_pages_for(n: i64) -> i64set_new
fn set_new(cap: i64) -> &i64Create a new set with given capacity (rounded up to power of 2, min 16).
set_hash
fn set_hash(val: i64, cap: i64) -> i64Internal: hash function for i64.
set_rehash
fn set_rehash(s: &i64)Internal: rehash when load factor > 0.7.
set_add
fn set_add(s: &i64, val: i64)Insert a value into the set.
set_has
fn set_has(s: &i64, val: i64) -> i64Check if value is in the set.
set_del
fn set_del(s: &i64, val: i64) -> i64Remove a value from the set. Returns 1 if found, 0 otherwise.
set_len
fn set_len(s: &i64) -> i64Number of elements.
set_clear
fn set_clear(s: &i64)Remove all elements.
set_union
fn set_union(a: &i64, b: &i64) -> &i64Union: returns new set containing all elements from a and b.
set_intersect
fn set_intersect(a: &i64, b: &i64) -> &i64Intersection: returns new set of elements in both a and b.
set_diff
fn set_diff(a: &i64, b: &i64) -> &i64Difference: returns new set of elements in a but not in b.
set_subset
fn set_subset(a: &i64, b: &i64) -> i64Subset: returns 1 if all elements of a are in b.
set_eq
fn set_eq(a: &i64, b: &i64) -> i64Equality: same elements in both sets.
set_to_vec
fn set_to_vec(s: &i64) -> &i64Convert set to vec (unordered).