Outcomes v0.1.0

Source
Asking which channel a native fallible T ! E holds without unwrapping it.

Succeeded<T, E>

pub func Succeeded<T, E>(outcome: T ! E) -> bool

Whether outcome holds a success. outcome is consumed; its payload is destroyed after the question is answered. Runs in constant time and allocates nothing.

Source

Type parameters

NameDescription
Tthe success type
Ethe error type

Parameters

NameTypeDescription
outcomeT ! Ethe fallible to ask

Returns: whether it holds a success

Failed<T, E>

pub func Failed<T, E>(outcome: T ! E) -> bool

Whether outcome holds a failure. outcome is consumed; its payload is destroyed after the question is answered. Runs in constant time and allocates nothing.

Source

Type parameters

NameDescription
Tthe success type
Ethe error type

Parameters

NameTypeDescription
outcomeT ! Ethe fallible to ask

Returns: whether it holds a failure