Skip to content

ErlangMap

[Source]

A map, kept as key/value pairs in the order they were encoded.

Equality ignores that order, as Erlang's does: two maps with the same pairs are the same value however they were written, and they hash alike. The order is kept so that printing a map shows the order it arrived in.

class val ErlangMap is
  Equatable[ErlangMap val] ref,
  Hashable ref

Implements


Constructors

create

[Source]

new val create(
  pairs': Array[(ErlangTerm , ErlangTerm)] val)
: ErlangMap val^

Parameters

Returns


binary_keyed

[Source]

A map whose keys are binaries, which is how Elixir writes %{"timeout" => 5000}.

new val binary_keyed(
  entries: Array[(String val , ErlangTerm)] val)
: ErlangMap val^

Parameters

Returns


atom_keyed

[Source]

A map whose keys are atoms: #{timeout => 5000}.

new val atom_keyed(
  entries: Array[(String val , ErlangTerm)] val)
: ErlangMap val^

Parameters

Returns


Public fields

let pairs: Array[(ErlangTerm , ErlangTerm)] val

[Source]


Public Functions

size

[Source]

fun box size()
: USize val

Returns


eq

[Source]

fun box eq(
  that: ErlangMap val)
: Bool val

Parameters

Returns


hash

[Source]

fun box hash()
: USize val

Returns


get

[Source]

The value under key, or None when the map has no such key.

Keys are compared as Erlang compares them, so a structurally equal key finds its value.

fun box get(
  key: ErlangTerm)
: (ErlangTerm | None val)

Parameters

Returns


get_binary

[Source]

The value under the binary key, which is how Elixir writes map keys.

A binary and an atom of the same name are different keys, so this finds nothing in a map keyed by atoms.

fun box get_binary(
  key: String val)
: (ErlangTerm | None val)

Parameters

Returns


get_atom

[Source]

The value under the atom key, e.g. #{timeout => 5000}.

fun box get_atom(
  key: String val)
: (ErlangTerm | None val)

Parameters

Returns


ne

[Source]

fun box ne(
  that: ErlangMap val)
: Bool val

Parameters

Returns