CBOR.Encoder protocol (cbor v2.0.0-rc1)

View Source

Protocol for serializing Elixir terms into CBOR.

Implementations for built-in types (atoms, integers, floats, binaries, lists, maps, Date, Time, DateTime, MapSet, URI, CBOR.Tag, ...) ship with this library. Define your own defimpl CBOR.Encoder, for: MyStruct to teach CBOR.encode/1 how to serialize custom types.

Summary

Types

t()

All the types that implement this protocol.

Functions

Append the CBOR encoding of element to acc and return the resulting binary.

Types

t()

@type t() :: term()

All the types that implement this protocol.

Functions

encode_into(element, acc)

@spec encode_into(t(), binary()) :: binary()

Append the CBOR encoding of element to acc and return the resulting binary.