View Source Aja.Pair (Aja v0.6.5)
Convenience helpers for working with {atom, value}
tuples without breaking the pipe.
Summary
Functions
Unwraps an idiomatic {atom, value}
tuple when the atom is what is being expected.
Convenient for not breaking the pipe.
Wraps the value
as an idiomatic {atom, value}
tuple.
Convenient for not breaking the pipe.
Functions
Unwraps an idiomatic {atom, value}
tuple when the atom is what is being expected.
Convenient for not breaking the pipe.
Examples
iex> {:ok, 55} |> Aja.Pair.unwrap!(:ok)
55
iex> :error |> Aja.Pair.unwrap!(:ok)
** (ArgumentError) unwrap!/2 expected {:ok, _}, got: :error
Wraps the value
as an idiomatic {atom, value}
tuple.
Convenient for not breaking the pipe.
Examples
iex> 55 |> Aja.Pair.wrap(:ok)
{:ok, 55}
iex> %{a: 5} |> Map.update!(:a, & &1 + 1) |> Aja.Pair.wrap(:no_reply)
{:no_reply, %{a: 6}}