View Source Yemux.Result (Yemux v0.2.1)

Tools for Result tuples {:ok|:error, any()}

Link to this section Summary

Functions

iex(1)> and_ok({:ok, nil}, fn -> 42 end)
{:ok, 42}

iex(2)> and_ok({:error, 41}, fn -> 42 end)
{:error, 41}

Link to this section Types

@type t() :: {:ok | :error, any()}

Link to this section Functions

Link to this function

and_ok(result, non_result)

View Source
@spec and_ok(t(), any()) :: t()
iex(1)> and_ok({:ok, nil}, fn -> 42 end)
{:ok, 42}

iex(2)> and_ok({:error, 41}, fn -> 42 end)
{:error, 41}