OkThen.Result.from

You're seeing just the function from, go back to OkThen.Result module for more information.

Specs

from(v) :: maybe(v) when v: any()

Converts value into a maybe(v) result: {:ok, value} | :none

If value is nil, then the result will be :none. See also from!/1.

Otherwise, the result will be a two-element tuple, where the first element is :ok, and the second element is value.

Examples

iex> Result.from("hello")
{:ok, "hello"}

iex> Result.from({1, 2})
{:ok, {1, 2}}

iex> Result.from({})
:ok

iex> Result.from(nil)
:none