# `Yex.Snapshot`
[🔗](https://github.com/satoren/y_ex/blob/main/lib/snapshot.ex#L1)

Opaque snapshot of a document state at a specific point in time.

Use `Yex.snapshot/1` to create it and `encode_state_v1/1`
or `encode_state_v2/1` to generate time-travel updates.

# `t`

```elixir
@type t() :: %Yex.Snapshot{doc: Yex.Doc.t(), reference: binary()}
```

# `encode_state_v1`

```elixir
@spec encode_state_v1(t()) :: {:ok, binary()} | {:error, term()}
```

Encodes document state represented by this snapshot in lib0 v1 format.

# `encode_state_v2`

```elixir
@spec encode_state_v2(t()) :: {:ok, binary()} | {:error, term()}
```

Encodes document state represented by this snapshot in lib0 v2 format.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
