# `PhoenixMicro.Utils.Encoding`
[🔗](https://github.com/iamkanishka/phoenix_micro/blob/v1.0.0/lib/phoenix_micro/utils/encoding.ex#L1)

Shared encoding/decoding helpers used across transports and the producer.

Provides a unified entry point for payload serialization so all transports
produce and consume messages in the same format regardless of the underlying
broker's wire format.

# `content_type`

```elixir
@spec content_type() :: String.t()
```

Returns the MIME content-type for the configured serializer.

# `decode`

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

Safely decodes a binary — returns `{:ok, term}` or `{:error, reason}`.

# `decode!`

```elixir
@spec decode!(binary()) :: term()
```

Decodes `binary` using the configured serializer.
Returns the decoded term.

# `encode`

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

Safely encodes a term — returns `{:ok, binary}` or `{:error, reason}`.

# `encode!`

```elixir
@spec encode!(term()) :: binary()
```

Encodes `payload` using the configured serializer.
Returns a binary.

---

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