Vibe.Session.Store.Codec (vibe v0.2.0)

Copy Markdown View Source

JSON codec for session event serialization and deserialization.

Summary

Functions

decode_eval_state_binary(binary)

@spec decode_eval_state_binary(binary()) ::
  {:ok, %{binding: Code.binding(), env: Macro.Env.t()}} | :error

decode_eval_state_line(line, acc)

@spec decode_eval_state_line(String.t(), term()) ::
  %{binding: Code.binding(), env: Macro.Env.t()} | term()

decode_trajectory_line(line)

@spec decode_trajectory_line(String.t()) :: [Vibe.Trajectory.t()]

decode_trajectory_map(map)

@spec decode_trajectory_map(map()) :: {:ok, Vibe.Trajectory.t()} | :error

decode_ui_event_line(line)

@spec decode_ui_event_line(String.t()) :: [{non_neg_integer(), Vibe.UI.Event.t()}]

decode_ui_event_map(map)

@spec decode_ui_event_map(map()) ::
  {:ok, {non_neg_integer(), Vibe.UI.Event.t()}} | :error

encode_trajectory(event)

@spec encode_trajectory(Vibe.Trajectory.t()) :: map()

encode_ui_event(event, seq)

@spec encode_ui_event(Vibe.UI.Event.t(), non_neg_integer()) :: map()

eval_state_entry(session_id, binding, env)

@spec eval_state_entry(String.t(), Code.binding(), Macro.Env.t()) ::
  {:ok, map()} | {:error, term()}

project_trajectory_events(events)

@spec project_trajectory_events([Vibe.Trajectory.t()]) :: [
  {pos_integer(), Vibe.UI.Event.t()}
]