Struct OpenXRResult<T>
Represents the result of a completed operation that attempted to create an object of type T.
Inherited Members
Namespace: UnityEngine.XR.OpenXR.Features.SpatialEntities
Assembly: Unity.XR.SpatialEntities.dll
Syntax
public readonly struct OpenXRResult<T> : IEquatable<OpenXRResult<T>>, IEquatable<Result<T>>
Type Parameters
| Name | Description |
|---|---|
| T | The result type. |
Constructors
OpenXRResult(OpenXRResultStatus, T)
Construct an instance with a given status and value.
Declaration
public OpenXRResult(OpenXRResultStatus status, T value)
Parameters
| Type | Name | Description |
|---|---|---|
| OpenXRResultStatus | status | The status. |
| T | value | The result value. |
OpenXRResult(T)
Construct a result containing an unqualified success status code and the given value.
Declaration
public OpenXRResult(T value)
Parameters
| Type | Name | Description |
|---|---|---|
| T | value | The value. |
Properties
status
The status of the completed operation. You should check whether the operation was successful before you access the result value.
Declaration
public OpenXRResultStatus status { get; }
Property Value
| Type | Description |
|---|---|
| OpenXRResultStatus |
value
The result value of the completed operation. Only valid if
status.IsSuccess() is true.
Declaration
public T value { get; }
Property Value
| Type | Description |
|---|---|
| T |
Remarks
Important
If the operation was unsuccessful, you should not access this value. It may be null or could contain default data.
Methods
Equals(Result<T>)
Compares for equality with a Result.
Declaration
public bool Equals(Result<T> other)
Parameters
| Type | Name | Description |
|---|---|---|
| Result<T> | other | The |
Returns
| Type | Description |
|---|---|
| bool |
|
Equals(OpenXRResult<T>)
Compares for equality with another instance.
Declaration
public bool Equals(OpenXRResult<T> other)
Parameters
| Type | Name | Description |
|---|---|---|
| OpenXRResult<T> | other | The other instance. |
Returns
| Type | Description |
|---|---|
| bool |
|
Operators
explicit operator OpenXRResult<T>(Result<T>)
Convert from Result to OpenXRResult.
Declaration
public static explicit operator OpenXRResult<T>(Result<T> result)
Parameters
| Type | Name | Description |
|---|---|---|
| Result<T> | result | The |
Returns
| Type | Description |
|---|---|
| OpenXRResult<T> | The output instance. |
implicit operator Result<T>(OpenXRResult<T>)
Convert from OpenXRResult to Result.
Declaration
public static implicit operator Result<T>(OpenXRResult<T> oxrResult)
Parameters
| Type | Name | Description |
|---|---|---|
| OpenXRResult<T> | oxrResult | The |
Returns
| Type | Description |
|---|---|
| Result<T> | The output instance. |