   end
 
   @doc """
-  Serializes a record using the binary serialization protocol.
-
-  `class_name` is a string containing the class name of the record being
-  encoded. `fields` is a list of `Field` structs.
   """
   def encode(%MarcoPolo.Record{} = record) do
     [0, encode_embedded(record, 1)]

  Record.defrecordp :typed_field, [:value, :type]

  Record.defrecordp :field_def, [:name, :ptr, :type]

  defmodule Field do
    @type t :: %__MODULE__{
      name: binary,
      type: atom,
      pointer_to_data: non_neg_integer,
      value: term,
      encoded_value: iodata,
    }

    defstruct ~w(name type pointer_to_data value encoded_value)a
  end

  @doc """
  Parses a binary-serialized record.

    [encoded_class, encoded_fields]
  end

  defp encode_field_for_header(name, ptr, value) do
    type = infer_type(value)
    if is_nil(value) do
