Gcode.Option (gcode v0.4.1)

A helper which represents an optional type.

Link to this section 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

Link to this section Types

Specs

opt_none() :: :error

Specs

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

Specs

t() :: t(any())

Specs

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

Link to this section Functions

Link to this macro

none()

(macro)

Specs

none() :: Macro.t()

Create or match a none

Specs

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

Is the value a none?

Link to this macro

some(pattern)

(macro)

Specs

some(any()) :: Macro.t()

Create or match a some

Specs

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

Is the value a some?

Specs

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

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