Struct Result
Embeds a return value for an API as well as any error code and an optional message.
struct Result(T)
;
Constructors
Name | Description |
---|---|
this
(value)
|
Ctor when there was no error |
this
(error, message)
|
Ctor when there was an error, with an optional message. |
Fields
Name | Type | Description |
---|---|---|
error
|
ErrorCode | The error code, if any |
message
|
string | The error message, if any |
value
|
T | The result, only valid if error != ErrorCode
|
Methods
Name | Description |
---|---|
toString
()
|
Convenience |
Parameters
Name | Description |
---|---|
T | the type stored as the value field |