Gcode.Result (gcode v0.4.1)
A helper which represents a result type.
This is really just a wrapper around Erlang's ok/error tuples.
Link to this section Summary
Functions
Initialise or match an error value
Is the result an error?
Convert a successful result another result.
Initialise or match an ok value
Is the result ok?
Attempt to unwrap a result and return the inner value. Raises an exception if the result contains an error.
Link to this section Types
Link to this type
error(error)
Specs
error(error) :: {:error, error}
Link to this type
ok(result)
Specs
ok(result) :: {:ok, result}
Specs
Link to this type
t(result)
Specs
Link to this type
t(result, error)
Specs
Link to this section Functions
Specs
Initialise or match an error value
Link to this function
error?(arg)
Specs
Is the result an error?
Link to this function
map(arg, mapper)
Specs
Convert a successful result another result.
Specs
Initialise or match an ok value
Link to this function
ok?(arg)
Specs
Is the result ok?
Link to this function
unwrap!(arg)
Specs
Attempt to unwrap a result and return the inner value. Raises an exception if the result contains an error.