Collections.Result<T, E> Struct

Namespace: Improbable.Gdk.CoreSource

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.

Updated about a year ago


Collections.Result<T, E> Struct


Suggested Edits are limited on API Reference Pages

You can only suggest edits to Markdown body content, but not to the API spec.