Gcode.Result.Enum (gcode v0.4.1)

Common enumerableish functions on results.

Link to this section Summary

Functions

Join the string contents of an ok result.

Maps a collection of results using a mapping function.

As long as the result of the reducer is ok, continue reducing, otherwise short circuit

Reverse the enumerable contents of an ok result.

Link to this section Types

Specs

result() :: Gcode.Result.t()
Link to this type

result(result)

Specs

result(result) :: Gcode.Result.t(result)
Link to this type

result(result, error)

Specs

result(result, error) :: Gcode.Result.t(result, error)

Link to this section Functions

Link to this function

join(arg, joiner)

Specs

join(result([String.t()]), String.t()) :: result(String.t())

Join the string contents of an ok result.

Link to this function

map(arg, mapper)

Specs

map(result([any()]), mapper :: (any() -> result(any()))) :: result([any()])

Maps a collection of results using a mapping function.

Both the input to the map must be an ok result and the result of each mapping function.

Link to this function

reduce_while_ok(elements, acc, reducer)

Specs

reduce_while_ok(
  enumerable :: any(),
  accumulator :: any(),
  reducer :: (any(), any() -> result(any()))
) :: result(any())

As long as the result of the reducer is ok, continue reducing, otherwise short circuit

Specs

reverse(result([any()])) :: result([any()])

Reverse the enumerable contents of an ok result.