defmodule Vela.Serializer.Native do @moduledoc """ Erlang term_to_binary serializer. Fast, supports all Elixir terms, but only readable by BEAM languages. """ @behaviour Vela.Serializer @impl true def encode(term, _opts) do {:ok, :erlang.term_to_binary(term)} end @impl true def decode(binary, _opts) do {:ok, :erlang.binary_to_term(binary)} rescue ArgumentError -> {:error, :invalid_binary} end end