View Source Pipeline.State (ex_pipeline v0.1.0)

Simple state management

Link to this section Summary

Functions

Executes the given callback passing the state and options as parameters.

Marks the given state as invalid

Marks the given state as invalid and adds an error

Creates a new, valid, %State{} struct with the given initial value

Updates a state with the given anonymous function

Link to this section Types

@type t() :: %Pipeline.State{
  errors: [any()],
  initial_value: any(),
  valid?: boolean(),
  value: any()
}

Link to this section Functions

Link to this function

callback(state, fun, options)

View Source

Executes the given callback passing the state and options as parameters.

@spec invalidate(t()) :: t()

Marks the given state as invalid

Link to this function

invalidate(state, error)

View Source
@spec invalidate(t(), any()) :: t()

Marks the given state as invalid and adds an error

@spec new(any()) :: t()

Creates a new, valid, %State{} struct with the given initial value

Link to this function

update(state, transform, options \\ [])

View Source

Updates a state with the given anonymous function