Sites

Menu

Result<T, E> Struct

Namespace: Improbable.Gdk.Core.Collections
GDK package: Core
Source

A type to represent a result. Can either have a success value or an error, but not both.

Type parameters

T : The type of the success value. E : The type of the error.


Fields

IsOkay Source
bool IsOkay

True if the result contains a success, false otherwise.
IsError Source
bool IsError

True if the result contains an error, false otherwise.


Static Methods

Ok Source
Result<T, E> Ok(T value)

Creates a result which contains a success value.

Returns:
The result object.

Parameters
  • T value : The value of the result.
Error Source
Result<T, E> Error(E error)

Creates a result which contains an error.

Returns:
The result object.

Parameters
  • E error : The value of the error.


Methods

Unwrap Source
T Unwrap()

Attempts to get the success value from the result.

Returns:
The success value of the result.

Exceptions:
  • InvalidOperationException : Thrown if the result contains an error.
UnwrapError Source
E UnwrapError()

Attempts to get the error from the result.

Returns:
The error from the result.

Exceptions:
  • InvalidOperationException : Thrown if result contains a success value.

Search results

Was this page helpful?

Thanks for letting us know!

Thanks for your feedback

Need more help? Ask on the forums