Option<T>
Option<T> expresses the presence (Some(value)) or absence (None) of a value. It is automatically in scope — no import required.
Constructing values
Methods
is_some / is_none
is_some / is_none
true if the option is Some or None respectively.unwrap
unwrap
self.is_some() and returns the wrapped value. Fails if the option is None.unwrap_or
unwrap_or
Some, or default when None.unwrap_or_else
unwrap_or_else
Some, or calls default() when None.unwrap_unchecked
unwrap_unchecked
is_some(). When the option is None, the return value is unspecified (zeroed memory). Use only when you have already verified the option is Some through another path.expect
expect
is_some() with a custom error message, then returns the value.map
map
f to the value if Some(x), returning Some(f(x)). Returns None if the option is None.map_or / map_or_else
map_or / map_or_else
map, but returns a default value instead of None when the option is None.and / and_then
and / and_then
and returns None if self is None, otherwise returns other.and_then (flat_map) calls f with the Some value, returning its result; returns None if self is None.or / or_else
or / or_else
self if it is Some, otherwise returns other / default().filter
filter
Some(x) if self is Some(x) and predicate(x) is true. Otherwise returns None.flatten
flatten
Option<Option<T>> into Option<T>. Returns None if the outer option is None.BoundedVec<T, MaxLen>
A growable array bounded by a compile-time maximum length MaxLen. Internally backed by a fixed-size array, so element access is always O(1).
Construction
Element access
get performs a bounds check and fails the constraint if index >= len. get_unchecked skips the check — only use it when you have already verified the index is in range.
Mutation
Length and capacity
max_len() always returns MaxLen. storage() gives direct access to the backing array — note that elements at indices >= len may be zeroed.
Bulk operations
MaxLen.
Functional methods
HashMap<K, V, MaxLen, B>
A bounded, compile-time-sized hash map using open addressing with quadratic probing. It stores up to MaxLen entries, but due to hash collisions the practical maximum may be lower. The load factor is capped at 0.75 — inserting beyond this limit causes a constraint failure.
K must implement Hash + Eq. B is a BuildHasher. The recommended hasher is BuildHasherDefault<Poseidon2Hasher>.
Construction
Insertion and removal
insert overrides the previous value if the key already exists. remove is a no-op if the key is absent.
Lookup
Size and capacity
capacity() always returns MaxLen. clear() removes all entries.
Iteration
iter_mut and iter_keys_mut rebuild the internal hash table as they run because keys affect slot positions. Prefer iter_values_mut when only values need to change.UHashMap<K, V, B>
UHashMap is an unbounded, dynamically-growing hash map for use in unconstrained or comptime code. Most operations on UHashMap are unconstrained — their results are not constrained when returned into constrained code.
UHashMap exposes the same method surface as HashMap: