Member group
OkOr
Declaring type: OptionalOperators
Module: System
Assembly: System.Runtime.dll
Overloads / Variants
OkOr
func OkOr<T, E>(error: E) -> Result<T, E>
Extension from OptionalOperators.OkOr
Converts Some to Ok, or None to Error using the supplied error or error-producing callback.
Parameters
| Name | Type | Description |
|---|---|---|
self |
Optional<T> | The source outcome or iterable on which the extension operates. |
error |
E | The error value or error-case callback indicated by this overload. |
Return value
Result<T, E>
OkOr
func OkOr<T, E>(errorFactory: () -> E) -> Result<T, E>
Extension from OptionalOperators.OkOr
Parameters
| Name | Type | Description |
|---|---|---|
self |
Optional<T> | |
errorFactory |
Function |
Return value
Result<T, E>