Enum Result

A Result is an Option that allows the error case to have a value, typically an error message.

enum Result[A, B]
{
    Failure(A),
    Success(B)
}

define failure: Option[A]

If self is Success, returns None.

Otherwise, this returns Some(A).

define is_failure: Boolean

Return true if self is Failure, false otherwise.

define is_success: Boolean

Return true if self is Success, false otherwise.

define success: Option[B]

If self is Succcess, returns Some(B).

Otherwise, this returns None.

define unwrap: B

If self is Success, this returns the value contained within.