abstract struct Result(T)
- Result(T)
- Struct
- Value
- Object
Overview
Wrap a value into a Result (like in Rust).
Direct Known Subclasses
Defined in:
result.crConstructors
Class Method Summary
Instance Method Summary
- #err? : Bool
- #initialize
- #ok? : Bool
- #state : Tuple(Symbol, Symbol, T)
-
#status : Symbol
Resultstatus as aSymbol(:done or :fail, etc). -
#status?(s : Symbol) : Bool
Checks a
#status. -
#type : Symbol
Resulttype as aSymbol(:ok or :err). -
#unwrap
Unwrap the result
#value(like Result::unwrap in Rust). -
#value : T
Returns the result value.
Constructor Detail
Class Method Detail
Instance Method Detail
def state : Tuple(Symbol, Symbol, T)
#
Extract the Result state (#type, #status and #value).
Inspired by the Elixir lang approach, it's handy for the pattern matching.