Zot.Context (zot v0.12.0)
View SourceContext management for parsing / validating values.
Summary
Types
Represents a segment in a path.
Zot's context struct encapsulates all that is needed to parse and validate a value.
Functions
Appends new issues to the context, what causes the context to be marked as invalid.
Increments the context's score by the given amount.
Creates a new context.
Parses the given context.
Puts the given path into the context.
Unwraps the Context into an :ok|:error tuple.
Checks if the context is valid.
Types
@type segment() :: String.t() | atom() | non_neg_integer()
Represents a segment in a path.
@type t() :: %Zot.Context{ input: term(), issues: [Zot.Issue.t()], opts: keyword(), output: term(), path: [segment()], score: integer(), type: struct(), valid?: boolean() }
Zot's context struct encapsulates all that is needed to parse and validate a value.
Functions
@spec append_issues(t(), [Zot.Issue.t()]) :: t()
Appends new issues to the context, what causes the context to be marked as invalid.
Increments the context's score by the given amount.
Creates a new context.
Parses the given context.
Puts the given path into the context.
@spec unwrap(t()) :: {:ok, term()} | {:error, [Zot.Issue.t(), ...]}
Unwraps the Context into an :ok|:error tuple.
Checks if the context is valid.