Under heavy development. This site describes the intended 1.0 language. Current features and performance vary. Development status
Sn50SnThe SnAPI programming language
Development · Evolving reference

CreateHashSet

Creates an empty hash set using built-in logical key hashing.

Sn is under heavy development. This reference includes the intended 1.0 design; features may be incomplete in the current compiler. Read the status →

Module std.collections

import std.collections;

Public declaration contracts and authored examples. A page can document several related symbols. Implementation bodies are excluded.

CreateHashSet

pub fn CreateHashSet<K>() -> HashSet<K>
    where K: BuiltinHashKey, Movable

Creates an empty hash set using built-in logical key hashing.

Construction allocates nothing. The returned owner allocates on fallible reserve/insertion; borrowed text keys still require their backing owner to outlive storage. Custom key types must supply an explicit policy through the HashSet constructor. Floating keys use canonical signed-zero/NaN equality. K: Supported built-in key representation, movable into storage. Return: Empty owning table with the default allocator and safe hash functions.

CreateHashSet

pub fn CreateHashSet<K, A>(mut AllocatorValue: A) -> HashSet<K, HashPolicy<K>, A>
    where K: BuiltinHashKey, Movable where A: Allocator, Defaultable, Movable

Creates an empty default-hash set with a transferred allocator.

Both table arrays remain owned by this allocator; failed insertion retains the input key. Construction allocates nothing and retains no external borrow. K: Supported built-in movable key representation. A: Movable Defaultable allocator type owning future table allocations. AllocatorValue: Allocator transferred into the returned table. Return: Empty table owning its allocator and default safe hash/equality policy.

Documentation snapshot: October 24, 2026 About versions ↗
Searching Development · language & standard library