class

Immutable::Vector::Trie(T)

Inherits Enumerable < Reference < Object

Constants

BITS_PER_LEVEL = 5_u32
BLOCK_SIZE = (2 ** BITS_PER_LEVEL).to_u32
INDEX_MASK = BLOCK_SIZE - 1

Constructors

new(children : Array(Trie(T)), levels : Int32, owner : UInt64 | Nil = nil)
Source
new(values : Array(T), owner : UInt64 | Nil = nil)
Source

Class methods

empty(owner : UInt64 | Nil = nil)
Source
from(elems : Array(T), owner : UInt64)
Source
from(elems : Array(T))
Source

Instance methods

at(index : Int, &)
Source
clear_owner!
Source
each

Must yield this collection's elements to the block.

Source
each
Source
empty?

Returns true if self does not contain any element.

([] of Int32).empty? # => true
([1]).empty?         # => false
[nil, false].empty?  # => false
  • #present? returns the inverse.
Source
get(index : Int)
Source
inspect

Returns an unambiguous and information-rich string representation of this object, typically intended for developers.

This method should usually not be overridden. It delegates to #inspect(IO) which can be overridden for custom implementations.

Also see #to_s.

Source
last
Source
last_leaf
Source
leaf?
Source
levels
Source
pop_leaf(from : UInt64 | Nil = nil) : Trie(T)
Source
pop_leaf!(from : UInt64) : Trie(T)
Source
push_leaf(leaf : Array(T), from : UInt64 | Nil = nil) : Trie(T)
Source
push_leaf!(leaf : Array(T), from : UInt64) : Trie(T)
Source
size

Returns the number of elements in the collection.

[1, 2, 3, 4].size # => 4
Source
update(index : Int, value : T) : Trie(T)
Source
update!(index : Int, value : T, from : UInt64) : Trie(T)
Source