frost.core

Choice Maybe<T>

Holds either a value or an Error. Maybe is intended for use as a return type for a method which returns a value, but is not always guaranteed to succeed.

Source Code:
View Source

Case Summary

SUCCESS(T)
A successful call with return value.
ERROR(Error)
An error occurred.
Inherited Fields:

Instance Method Summary

get():T
Returns the result of a successful call.
error():Error
Returns the error message of a failed call.
succeeded():Bit
Returns true if the call succeeded.

Cases

SUCCESS(T)

A successful call with return value.

ERROR(Error)

An error occurred.

Instance Methods

@pre(succeeded())
function get ():T

Returns the result of a successful call.

@pre(!succeeded())
function error ():Error

Returns the error message of a failed call.

function succeeded ():Bit

Returns true if the call succeeded.