Skip to content

ErlangValues

[Source]

Takes a value out of a term, keeping the term model out of the caller's code.

Each function answers None when the term is of another kind, or when there is no term at all, so a lookup and the read that follows are one expression and two clauses:

match ErlangValues.integer(config.get(ErlangBinary("timeout")))
| let timeout: I64 => use(timeout)
| None => use(5_000)
end

Nothing here casts: the type is known once the second clause is reached, and a value of the wrong kind is a None rather than an error.

primitive val ErlangValues

Constructors

create

[Source]

new val create()
: ErlangValues val^

Returns


Public Functions

atom_name

[Source]

The name of an atom.

fun box atom_name(
  term: (ErlangTerm | None val))
: (String val | None val)

Parameters

Returns


bytes

[Source]

The bytes of a binary, as they arrived.

fun box bytes(
  term: (ErlangTerm | None val))
: (String val | None val)

Parameters

Returns


chars

[Source]

The bytes of a string, which is a charlist on the wire.

fun box chars(
  term: (ErlangTerm | None val))
: (String val | None val)

Parameters

Returns


integer

[Source]

The value of an integer that fits into 64 bits.

A wider integer is an ErlangBigInteger and answers None here; read it through decimal() instead of narrowing it silently.

fun box integer(
  term: (ErlangTerm | None val))
: (I64 val | None val)

Parameters

Returns


float

[Source]

The value of a float.

fun box float(
  term: (ErlangTerm | None val))
: (F64 val | None val)

Parameters

Returns


pid

[Source]

The pid itself, ready to send to.

fun box pid(
  term: (ErlangTerm | None val))
: (ErlangPid val | None val)

Parameters

Returns


eq

[Source]

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

Parameters

Returns


ne

[Source]

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

Parameters

Returns