Gcode.Option (gcode v1.0.0)

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

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

Link to this section Functions

Link to this macro

none()

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

Create or match a none

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

Is the value a none?

Link to this macro

some(pattern)

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

Create or match a some

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

Is the value a some?

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

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