# `Membrane.Payload`
[🔗](https://github.com/membraneframework/membrane-core/blob/v1.2.6/lib/membrane/payload.ex#L1)

This protocol describes actions common to all payload types.

The most basic payload type is simply a binary for which `Elixir.Membrane.Payload`
is implemented by the Membrane Core.

# `t`

```elixir
@type t() :: any()
```

A type describing all the types that implement `Membrane.Payload` protocol.

# `concat`

```elixir
@spec concat(left :: t(), right :: t()) :: t()
```

Concatenates the contents of two payloads.

# `drop`

```elixir
@spec drop(payload :: t(), n :: non_neg_integer()) :: t()
```

Drops first `n` bytes of payload.

# `module`

```elixir
@spec module(t()) :: module()
```

Returns a module responsible for this type of payload
and implementing `Membrane.Payload.Behaviour`

# `size`

```elixir
@spec size(payload :: t()) :: non_neg_integer()
```

Returns total size of payload in bytes

# `split_at`

```elixir
@spec split_at(payload :: t(), at_pos :: pos_integer()) :: {t(), t()}
```

Splits the payload at given position (1st part has the size equal to `at_pos` argument)

`at_pos` has to be greater than 0 and smaller than the size of payload, otherwise
an error is raised. This guarantees returned payloads are never empty.

# `to_binary`

```elixir
@spec to_binary(t()) :: binary()
```

Converts payload into binary

---

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