EMessage¶
An encoded Erlang message: the bytes of one term in the external format.
EMessage.begin() starts an empty message to encode into, encode(term)
writes a whole term into it, and the decode_* functions read terms out at a
position. For the usual "bytes in, term out" direction see
ErlangTermDecoder.
Constructors¶
begin¶
Returns¶
- EMessage ref^
from_cpointer¶
Takes ownership of a message received from the C layer.
Parameters¶
Returns¶
- EMessage ref^
Public fields¶
let beginning: I32 val¶
Public Functions¶
valid¶
Returns¶
- Bool val
length¶
Returns¶
- USize val
write_position¶
Where the next term would start.
Returns¶
- I32 val
truncate¶
Forgets everything written after position.
Parameters¶
- position: I32 val
Returns¶
- Bool val
cpointer¶
Returns¶
type_at¶
The type tag and payload size of the term at position.
Parameters¶
- position: I32 val
Returns¶
skip_term¶
The position just past the term at position, -1 for an invalid term.
Parameters¶
- position: I32 val
Returns¶
- I32 val
copy_bytes¶
The encoded bytes of a term, which is how unmodelled terms are kept.
Parameters¶
Returns¶
append_raw¶
Appends bytes that are already in the external format.
Parameters¶
- encoded: String val
Returns¶
- I32 val
decode_atom¶
Parameters¶
- position: I32 val
Returns¶
decode_int¶
Parameters¶
- position: I32 val
Returns¶
decode_double¶
Parameters¶
- position: I32 val
Returns¶
decode_binary¶
Parameters¶
- position: I32 val
Returns¶
decode_bitstring¶
Parameters¶
- position: I32 val
Returns¶
- ((ErlangBitstring val | None val) , I32 val)
decode_string¶
Parameters¶
- position: I32 val
Returns¶
decode_list_header¶
Parameters¶
- position: I32 val
Returns¶
decode_tuple_header¶
Parameters¶
- position: I32 val
Returns¶
decode_map_header¶
Parameters¶
- position: I32 val
Returns¶
decode_pid¶
Parameters¶
- position: I32 val
Returns¶
decode_port¶
Parameters¶
- position: I32 val
Returns¶
- ((ErlangPort val | None val) , I32 val)
decode_reference¶
Parameters¶
- position: I32 val
Returns¶
- ((ErlangReference val | None val) , I32 val)
encode¶
Writes a whole term into the message.
A term that cannot be written leaves the message as it was, so a caller that handles the error does not send a truncated term.
Parameters¶
- term: ErlangTerm
Returns¶
- None val ?
encode_atom¶
Parameters¶
- name: String val
Returns¶
- I32 val
encode_int¶
Parameters¶
- value: I64 val
Returns¶
- I32 val
encode_double¶
Parameters¶
- value: F64 val
Returns¶
- I32 val
encode_binary¶
Parameters¶
- value: String val
Returns¶
- I32 val
encode_bitstring¶
Parameters¶
Returns¶
- I32 val
encode_string¶
Parameters¶
- value: String val
Returns¶
- I32 val
encode_list_header¶
Parameters¶
- arity: USize val
Returns¶
- I32 val
encode_empty_list¶
Returns¶
- I32 val
encode_tuple_header¶
Parameters¶
- arity: USize val
Returns¶
- I32 val
encode_map_header¶
Parameters¶
- arity: USize val
Returns¶
- I32 val
encode_pid¶
Parameters¶
Returns¶
- I32 val
encode_port¶
Parameters¶
Returns¶
- I32 val
encode_reference¶
Parameters¶
Returns¶
- I32 val
dispose¶
Frees the message now instead of waiting for the collector.
Returns¶
- None val