# `FSST`
[🔗](https://github.com/elixir-vibe/fsst/blob/v0.1.2/lib/fsst.ex#L1)

Fast Static Symbol Tables compression for Elixir.

`FSST` is a pure Elixir port with an optional Rustler backend planned around
[`fsst-rs`](https://docs.rs/fsst-rs/latest/fsst/). The API follows typical
Elixir conventions: `train/2` returns `{:ok, table}` or `{:error, reason}`,
while `train!/2`, `compress!/3`, and `decompress!/3` raise on failure.

# `reason`

```elixir
@type reason() ::
  :backend_unavailable
  | :invalid_input
  | :invalid_sample
  | :truncated_escape
  | term()
```

# `table`

```elixir
@type table() :: FSST.Table.t()
```

# `backend`

```elixir
@spec backend(keyword()) :: module()
```

Returns the backend module selected for the current options and runtime.

# `compress`

```elixir
@spec compress(table(), binary(), keyword()) :: {:ok, binary()} | {:error, reason()}
```

Compresses a binary with a table returned by `train/2`.

# `compress!`

```elixir
@spec compress!(table(), binary(), keyword()) :: binary()
```

Compresses a binary or raises on failure.

# `decompress`

```elixir
@spec decompress(table(), binary(), keyword()) :: {:ok, binary()} | {:error, reason()}
```

Decompresses a binary with the same table used for compression.

# `decompress!`

```elixir
@spec decompress!(table(), binary(), keyword()) :: binary()
```

Decompresses a binary or raises on failure.

# `train`

```elixir
@spec train(
  [binary()],
  keyword()
) :: {:ok, table()} | {:error, reason()}
```

Trains an FSST table from representative binary samples.

# `train!`

```elixir
@spec train!(
  [binary()],
  keyword()
) :: table()
```

Trains an FSST table or raises when training fails.

---

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