externalterm.h
Include dependency graph for externalterm.h:
This graph shows which files directly or indirectly include externalterm.h:
External term deserialization functions.
This header provides external term deserialization functions.
Enums
Functions
-
term externalterm_to_term(const void *external_term, size_t size, Context *ctx, ExternalTermOpts opts)
Gets a term from external term data.
Deserialize an external term from external format and returns a term.
- Parameters:
external_term – the external term that will be deserialized.
size – to allocate for term.
ctx – the context that owns the memory that will be allocated.
opts – if non-zero, use a heap fragment to store the generated terms. Otherwise, use the heap in the provided context. Note that when using the context heap, this function may call the GC, if there is insufficient space to store the generated terms.
- Returns:
a term.
-
enum ExternalTermResult externalterm_from_binary(Context *ctx, term *dst, term binary, size_t *bytes_read)
Create a term from a binary.
Deserialize a binary term that stores term data in Erlang external term format, and instantiate the serialized terms. The heap from the context will be used to allocate the instantiated terms. This function is the complement of externalterm_to_binary. WARNING: This function may call the GC, which may render the input binary invalid.
- Parameters:
ctx – the context that owns the memory that will be allocated.
dst – a pointer to a term that will contain the binary encoded term.
binary – the binary.
bytes_read – the number of bytes read from the input binary.
- Returns:
the term deserialized from the input term, or an invalid term, if deserialization fails.
-
term externalterm_to_binary(Context *ctx, term t)
Create a binary from a term.
Serialize a term in Erlang external term format, and store the result in a binary term. The heap from the context will be used to allocate the hydrated terms. This function is the complement of externalterm_to_binary. WARNING: This function may call the GC, which may render the input binary invalid.
- Parameters:
ctx – the context that owns the memory that will be allocated.
t – the term to return as binary.
- Returns:
the term deserialized from the input term, or an invalid term, if deserialization fails.