Gcode.Option (gcode v1.0.2)

Copy Markdown

A helper which represents an optional type.

Summary

Functions

Create or match a none

Is the value a none?

Create or match a some

Is the value a some?

Attempt to unwrap an option. Raises an error if the option is a none

Types

opt_none()

@type opt_none() :: :error

some(t)

@type some(t) :: {:ok, t}

t()

@type t() :: t(any())

t(value)

@type t(value) :: some(value) | opt_none()

Functions

none()

(macro)
@spec none() :: Macro.t()

Create or match a none

none?(arg1)

@spec none?(t(any())) :: boolean()

Is the value a none?

some(pattern)

(macro)
@spec some(any()) :: Macro.t()

Create or match a some

some?(arg1)

@spec some?(t(any())) :: boolean()

Is the value a some?

unwrap!(arg1)

@spec unwrap!(t()) :: any() | no_return()

Attempt to unwrap an option. Raises an error if the option is a none