data Set
Hash set with insertion-ordered iteration (§3.3).
Example:
fn main() io {
var seen: Set<str> = Set.new()
print("{seen.insert("a")} {seen.insert("a")} {seen.len()}")
}Output
true false 1
@builtin("Set") pub(api) data Set<T>Complexity. `insert`, `remove` and `contains` are O(1) on average.
Thread safety. not shared between tasks; send a copy (or a `frozen` set) to another task.
Since. 1.0.0-beta
Methods
new | () -> SelfTrue when the set has no elements. |
len | () -> usizeThe number of elements. |
isEmpty | () -> boolWhether the set has no elements. |
insert | (x: T) -> boolTrue when x is in the set. |
remove | (x: T) -> boolRemoves x; true when it was in the set. |
contains | (x: T) -> boolWhether x is in the set. |
iter | () -> iter<T>Lazy iterator over a snapshot of the elements (insertion order). |
Defined in: std/core/types.oxl:62