[−][src]Enum rust_eterm::terms::TermTag
Variants
Refers to the atom with AtomCacheReferenceIndex in the distribution header.
Binary representation
| 1 byte | 1 byte |
|---|---|
82 | AtomCacheReferenceIndex |
String representation
This string is represented just like an atom.
The value of this atom is looked up in the distribution header.
Unsigned 8-bit integer.
Binary representation
| 1 byte | 1 byte |
|---|---|
97 | u8 |
String representation
Represent the value of this 2's complement 8-bit signed integer as either:
- Simple decimal
- An ASCII character Z in the form
$Z - Any other base B in 2..36 in the form
B#N
The recommendation is to always output like a simple decimal, as it is the simplest and most portable.
Signed 32-bit integer.
Binary layout
| 1 byte | 4 bytes |
|---|---|
98 | i32 |
String representation
The representations of this 2's complement 32-bit signed integer are:
- Simple decimal
- An ASCII character Z in the form
$Z - Any other base B in 2..36 in the form
B#N
The recommendation is to always output like a simple decimal, as it is the simplest and most portable.
A finite float (i.e. not inf, -inf or NaN) is stored in string format.
This term is used in minor version 0 of the external format;
it has been superseded by NewFloat.
Binary representation
| 1 byte | 31 bytes |
|---|---|
99 | Float as string |
The format used in sprintf to format the float is %.20e (there are
more bytes allocated than necessary).
String representation
The parsable values should be a decimal integer with either an exponent
or a trailing dot with 1 or more numbers behind it.
An optional base can also be specified in front of it, separating the
value and base with an octothorpe (#).
The recommendation is to output with the format being %.20e as it is
guaranteed not to lose precision.
Same as NewPort except the Creation field is only one byte and
only two bits are significant, the rest are to be 0.
Binary representation
| 1 byte | N bytes | 4 bytes | 1 byte |
|---|---|---|---|
102 | Node | ID | Creation |
Nodeis the name of the originating node, encoded usingAtomUtf8,SmallAtomUtf8orAtomCacheRef.IDis a 32-bit big endian unsigned integer. Only 15 bits are significant; the rest are to be 0.Creationis a 8-bit unsigned integer. All ports originating from the same node incarnation must have identical Creation values. This makes it possible to separate identifiers from old (crashed) nodes from a new one. The value zero should be avoided for normal operations as it is used as a wild card for debug purpose (like a pid returned by [erlang:list_to_pid/1]).
String representation
There is not actually a good way to represent a port as a string
because the Node value may not be known.
A representation of #Port<0.{id}.{creation}> can be used as a means
to visualize the value of a port regardless.
Encodes a port identifier (obtained from erlang:open_port/2).
Introduced in OTP 19, but only to be decoded and echoed back. Not encoded for local ports. Planned to supersede PORT_EXT in OTP 23 when DFLAG_BIG_CREATON becomes mandatory.
Binary representation
| 1 byte | N bytes | 4 bytes | 4 bytes |
|---|---|---|---|
89 | Node | ID | Creation |
Nodeis the name of the originating node, encoded usingAtomUtf8,SmallAtomUtf8orAtomCacheRef.IDis a 32-bit big endian unsigned integer. Only 15 bits are significant; the rest are to be 0.Creationis a 32-bit big endian unsigned integer. All ports originating from the same node incarnation must have identical Creation values. This makes it possible to separate identifiers from old (crashed) nodes from a new one. The value zero should be avoided for normal operations as it is used as a wild card for debug purpose (like a pid returned by [erlang:list_to_pid/1]).
String representation
There is not actually a good way to represent a port as a string
because the Node value may not be known.
A representation of #Port<0.{id}.{creation}> can be used as a means to
visualize the value of a port regardless.
Same as NewPid except the Creation field is only one byte and only
two bits are significant, the rest are to be 0.
Binary representation
| 1 byte | N bytes | 4 bytes | 4 bytes | 1 byte |
|---|---|---|---|---|
103 | Node | ID | Serial | Creation |
Nodeis the name of the originating node, encoded usingAtomUtf8,SmallAtomUtf8orAtomCacheRef.IDis a 32-bit big endian unsigned integer. Only 15 bits are significant; the rest are to be 0.Serialis a 32-bit big endian unsigned integer. Only 13 bits are significant; the rest are to be 0.Creationis a 8-bit unsigned integer. All identifiers originating from the same node incarnation must have identical Creation values. This makes it possible to separate identifiers from old (crashed) nodes from a new one. The value zero should be avoided for normal operations as it is used as a wild card for debug purpose (like a pid returned by [erlang:list_to_pid/1]).
String representation
There is not actually a good way to represent a pid as a string because
the Node value may not be known.
A representation of <0.{id}.{creation}> can be used as a means to
visualize the value of a pid regardless.
Encodes an Erlang process identifier object.
Introduced in OTP 19, but only to be decoded and echoed back.
Not encoded for local processes.
Planned to supersede Pid in OTP 23 when DFLAG_BIG_CREATON
becomes mandatory.
Binary representation
| 1 byte | N bytes | 4 bytes | 4 bytes | 4 bytes |
|---|---|---|---|---|
88 | Node | ID | Serial | Creation |
Nodeis the name of the originating node, encoded usingAtomUtf8,SmallAtomUtf8orAtomCacheRef.IDis a 32-bit big endian unsigned integer. Only 15 bits are significant; the rest are to be 0.Serialis a 32-bit big endian unsigned integer. Only 13 bits are significant; the rest are to be 0.Creationis a 32-bit big endian unsigned integer. All identifiers originating from the same node incarnation must have identical Creation values. This makes it possible to separate identifiers from old (crashed) nodes from a new one. The value zero should be avoided for normal operations as it is used as a wild card for debug purpose (like a pid returned by [erlang:list_to_pid/1]).
String representation
There is not actually a good way to represent a pid as a string because
the Node value may not be known.
A representation of <0.{id}.{creation}> can be used as a means to
visualize the value of a pid regardless.
Encodes a tuple.
Binary representation
| 1 byte | 1 byte | N bytes |
|---|---|---|
104 | Arity | Elements |
Arityis an unsigned 8-bit integer.Elementsare each encoded terms. There areArityamount of elements.
String representation
The string representation is simply a comma-separated list of stringified terms completely wrapped with curly braces.
Same as SmallTuple except that Arity is an unsigned 4 byte
integer.
Binary representation
| 1 byte | 4 bytes | N bytes |
|---|---|---|
105 | Arity | Elements |
Arityis an unsigned 32-bit big-endian integer.Elementsare each encoded terms. There areArityamount of elements.
String representation
The string representation is simply a comma-separated list of stringified terms completely wrapped with curly braces.
Encodes a map.
Binary representation
| 1 byte | 4 bytes | N bytes |
|---|---|---|
116 | Arity | Pairs |
Arityis the amount of key-value pairs in this map.Pairsare each two encoded terms. There areArityamount of pairs. There are no duplicate keys.
String representation
A map is represented like this:
#{ key0 => value0 (, keyN => valueN )* }
The representation for an empty list, that is, the Erlang syntax [].
Binary representation
| 1 byte |
|---|
106 |
String representation
[].
String does not have a corresponding Erlang representation, but is an optimization for sending lists of bytes (integer in the range 0-255) more efficiently over the distribution.
As field Length is an unsigned 2 byte integer (big-endian),
implementations must ensure that lists longer than 65535 elements are
encoded as List.
Binary representation
| 1 byte | 2 bytes | Length bytes |
|---|---|---|
| 107 | Length | Characters |
The characters are UTF-8 encoded characters. There are a maximum of 65535 bytes, however many characters that turns out to be. It is not a maximum of 65535 characters!
String representation
Place the string between double quotes, and apply the following escape sequences:
| Actual character | Escape sequence |
|---|---|
| backspace | \b |
| delete | \d |
| escape | \e |
| form feed | \f |
| newline | \n |
| carriage return | \r |
| tab | \t |
| vertical tab | \v |
| double qoute (") | \" |
The representation for a non-empty list.
Binary representation
| 1 byte | 4 bytes | N bytes | M bytes |
|---|---|---|---|
| 108 | Length | Elements | Tail |
Lengthis a 32-bit big-endian unsigned number that is the number of elements that follows in sectionElements.Elementsare each encoded terms.Tailis the final tail of the list; it isNilfor a proper list, but can be any type if the list is improper (for example,[a|b]).
String representation
Place a comma-separated list of stringified terms between block-quotes.
Binaries are byte-arrays. They are represented as bitstrings or binaries in the Erlang language.
Binary representation
| 1 byte | 4 bytes | Len bytes |
|---|---|---|
109 | Len | Data |
- The Len length field is an unsigned 4 byte integer (big-endian).
String representation
The output format is simply to convert each byte to a decimal number
and print them as a comma-separated list between a pair of double angle
brackets (<<, >>).
For reading, the values should be any of:
- A number according to
Integer
Integer representation of an integer N where -2^256 < N < 2^256.
Binary representation
| 1 byte | 1 byte | 1 byte | Len bytes |
|---|---|---|---|
110 | Len | Sign | d0..d(Len - 1) |
Bignums are stored in unary form with a Sign byte, that is, 0 if the bignum is positive and 1 if it is negative. The digits are stored with the least significant byte stored first. To calculate the integer, the following formula can be used:
B = 256
(d0*B^0 + d1*B^1 + d2*B^2 + ... d(N-1)*B^(n-1))
String representation
The representations of this 2's complement 32-bit signed integer are:
- Simple decimal
- An ASCII character Z in the form
$Z - Any other base B in 2..36 in the form
B#N
The recommendation is to always output like a simple decimal, as it is the simplest and most portable.
Integer representation of an integer N where -2^(2^32) < N < 2^(2^32).
Binary representation
| 1 byte | 4 bytes | 1 byte | Len bytes |
|---|---|---|---|
111 | Len | Sign | d0..d(Len - 1) |
Bignums are stored in unary form with a Sign byte, that is, 0 if the bignum is positive and 1 if it is negative. The digits are stored with the least significant byte stored first. To calculate the integer, the following formula can be used:
B = 256
(d0*B^0 + d1*B^1 + d2*B^2 + ... d(N-1)*B^(n-1))
String representation
The representations of this 2's complement 32-bit signed integer are:
- Simple decimal
- An ASCII character Z in the form
$Z - Any other base B in 2..36 in the form
B#N
The recommendation is to always output like a simple decimal, as it is the simplest and most portable.
Deprecated method for encoding a reference term.
Binary representation
| 1 byte | N bytes | 4 bytes | 1 byte |
|---|---|---|---|
101 | Node | ID | Creation |
Nodeis the name of the originating node, encoded usingAtomUtf8,SmallAtomUtf8orAtomCacheRef.Creationis a 8-bit unsigned integer. All references originating from the same node incarnation must have identical Creation values. This makes it possible to separate references from old (crashed) nodes from a new one. The value zero should be avoided for normal operations as it is used as a wild card for debug purpose (like a pid returned by [erlang:list_to_pid/1]).IDis a node-unique number that describes this reference uniquely.
Deprecated method for encoding a reference term.
Binary representation
| 1 byte | 2 bytes | N bytes | 1 byte | Len * 4 bytes |
|---|---|---|---|---|
101 | Len | Node | Creation | ID |
-
Nodeis the name of the originating node, encoded usingAtomUtf8,SmallAtomUtf8orAtomCacheRef. -
Creationis a 8-bit unsigned integer. All references originating from the same node incarnation must have identical Creation values. This makes it possible to separate references from old (crashed) nodes from a new one. The value zero should be avoided for normal operations as it is used as a wild card for debug purpose (like a pid returned by [erlang:list_to_pid/1]). -
Lendescribes how many 32-bit values are contained withinID. -
IDis a series of 32-bit unsigned integers. The erlang docs state:A sequence of
Lenbig-endian unsigned integers (4 bytes each, soN' = 4 * Len), but is to be regarded as uninterpreted data.I am having trouble interpreting this statement, so the assumption is that only the first is interpreted, and only the 18 least-significant bits of that value are interpreted, and that the rest are to be 0.
Encodes a reference term.
Binary representation
| 1 byte | 2 bytes | N bytes | 4 bytes | Len * 4 bytes |
|---|---|---|---|---|
90 | Len | Node | Creation | ID |
-
Nodeis the name of the originating node, encoded usingAtomUtf8,SmallAtomUtf8orAtomCacheRef. -
Creationis a 32-bit big-endian unsigned integer. All references originating from the same node incarnation must have identical Creation values. This makes it possible to separate references from old (crashed) nodes from a new one. The value zero should be avoided for normal operations as it is used as a wild card for debug purpose (like a pid returned by [erlang:list_to_pid/1]). -
Lendescribes how many 32-bit values are contained withinID. -
IDis a series of 32-bit unsigned integers. The erlang docs state:A sequence of
Lenbig-endian unsigned integers (4 bytes each, soN' = 4 * Len), but is to be regarded as uninterpreted data.I am having trouble interpreting this statement, so the assumption is that only the first is interpreted, and only the 18 least-significant bits of that value are interpreted, and that the rest are to be 0.
Old encoding of internal functions:
fun F/A and fun(Arg1,..) -> ... end.
Binary representation
| 1 byte | 4 bytes | N bytes | N' bytes | N'' bytes | N''' bytes | N'''' bytes |
|---|---|---|---|---|---|---|
117 | NumFree | Pid | Module | Index | Uniq | Free vars... |
NumFreeis a 32-bit big-endian unsigned integer is the number of free variables (Free vars).Pidis a process identifier as inPid. Represents the process in which the fun was created.Module, encoded as an atom usingAtomUtf8,SmallAtomUtf8, orAtomCacheRef, is the module that the fun is implemented in.Index, encoded as an integer usingSmallIntegerorIntegeris typically a small index into the module's fun table.Uniq, encoded as an integer usingSmallIntegerorIntegeris the hash value of the parse for the fun.Free varsareNumFreeamount of terms, each one encoded according to its type.
Encoding of internal functions: fun F/A and fun(Arg1,..) -> ... end.
Binary representation
| 1 byte | 4 bytes | 1 byte | 16 bytes | 4 bytes | 4 bytes | N bytes | N' bytes | N'' bytes | N''' bytes | N'''' bytes |
|---|---|---|---|---|---|---|---|---|---|---|
112 | Size | Arity | Uniq | Index | NumFree | Module | OldIndex | OldUniq | Pid | Free vars... |
Sizeis the total number of bytes, including field Size.Arityis the arity of the function implementing the fun, as an 8-bit unsigned number.Uniqis a 16 bytes MD5 of the significant parts of the Beam file.Indexis a 32-bit big endian unsigned index number. Each fun within a module has an unique index.NumFreeis the number of free variables, stored as a 32-bit big endian unsigned integer.Module, encoded as an atom usingAtomUtf8,SmallAtomUtf8, orAtomCacheRef, is the module that the fun is implemented in.OldIndex, encoded as an integer encoded usingSmallIntegerorInteger, is typically a small index into the module's fun table.OldUniq, encoded as an integer using usingSmallIntegerorInteger, is the hash value of the parse tree for the fun.Pid, encoded usingPid, represnts the process in which the fun was created.Free varsareNumFreeamount of terms, each one encoded according to its type.
Encodes functions of the shape fun M:F/A.
Binary representation
| 1 byte | N bytes | N' bytes | N'' bytes |
|---|---|---|---|
113 | Module | Function | Arity |
Module, encoded usingAtomUtf8,SmallAtomUtf8, orAtomCacheRef, is the module that exports this function.Function, encoded usingAtomUtf8,SmallAtomUtf8, orAtomCacheRef, is the name of this function.Arity, encoded usingSmallInteger, is the arity of this function.
This term represents a bitstring whose length in bits does not have to be a multiple of 8.
Binary representation
| 1 byte | 4 bytes | 1 byte | Len bytes |
|---|---|---|---|
77 | Len | Bits | Data |
Len, encoded as a 32-bit big endian unsigned integer, is the amount ofDatabytes.Bits, encoded as an 8-bit number N, where 1 >= N >= 8, is the amount of bits that are used in the last data byte, counting from most significant to least significant.Datais the actual binary data in this bitstring.
This term represents a float
Binary representation
| 1 byte | 8 bytes |
|---|---|
70 | Float |
Floatis an 32-bit IEEE floating point number stored in big-endian format.
This term represents an atom.
Binary representation
| 1 byte | 2 bytes | Len bytes |
|---|---|---|
118 | Len | AtomName |
Len, represented as a 16-bit big-endian unsigned integer, is the amount of bytes the atom name takes.AtomNameis an unescaped UTF8 string ofLenbytes long representing the name of this atom.
This term represents an atom that takes up at most 255 bytes (which may be less than 255 characters as UTF-8 can have multi-byte characters).
Binary representation
| 1 byte | 1 byte | Len bytes |
|---|---|---|
118 | Len | AtomName |
Len, represented as an 8-bit unsigned integer, is the amount of bytes the atom name takes.AtomNameis an unescaped UTF8 string ofLenbytes long representing the name of this atom.
This represents a LATIN-1 atom, but should not be encoded anymore.
Binary representation
| 1 byte | 2 bytes | Len bytes |
|---|---|---|
118 | Len | AtomName |
Len, represented as an 16-bit big endian unsigned integer, is the amount of bytes the atom name takes.AtomNameis an unescaped LATIN-1 string ofLenbytes long representing the name of this atom.
This represents a LATIN-1 atom, but should not be encoded anymore.
Binary representation
| 1 byte | byte | Len bytes |
|---|---|---|
118 | Len | AtomName |
Len, represented as an 8-bit unsigned integer, is the amount of bytes the atom name takes.AtomNameis an unescaped LATIN-1 string ofLenbytes long representing the name of this atom.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for TermTag
impl Send for TermTag
impl Sync for TermTag
impl Unpin for TermTag
impl UnwindSafe for TermTag
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized, [src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized, [src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized, [src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T[src]
impl<T> From<T> for T[src]
impl<T, U> Into<U> for T where
U: From<T>, [src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>, [src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>, [src]
U: TryFrom<T>,