Class BoolAsyncExtensions
Provides extension methods for boolean values.
Inherited Members
Namespace: RustyOptions.Async
Assembly: RustyOptions.dll
Syntax
public static class BoolAsyncExtensions
Methods
| Edit this page View SourceThenAsync<T>(bool, Func<Task<T>>)
Executes an asynchronous function if the boolean value is true and returns an option.
Declaration
public static ValueTask<Option<T>> ThenAsync<T>(this bool self, Func<Task<T>> thenFunc) where T : notnull
Parameters
Type | Name | Description |
---|---|---|
bool | self | The boolean value. |
Func<Task<T>> | thenFunc | The function to execute if the boolean value is true. |
Returns
Type | Description |
---|---|
ValueTask<Option<T>> | An option containing the result of the function if the boolean value is true, otherwise the default option value. |
Type Parameters
Name | Description |
---|---|
T | The type of the option value. |
ThenAsync<T>(bool, Func<ValueTask<T>>)
Executes an asynchronous function if the boolean value is true and returns an option.
Declaration
public static ValueTask<Option<T>> ThenAsync<T>(this bool self, Func<ValueTask<T>> thenFunc) where T : notnull
Parameters
Type | Name | Description |
---|---|---|
bool | self | The boolean value. |
Func<ValueTask<T>> | thenFunc | The function to execute if the boolean value is true. |
Returns
Type | Description |
---|---|
ValueTask<Option<T>> | An option containing the result of the function if the boolean value is true, otherwise the default option value. |
Type Parameters
Name | Description |
---|---|
T | The type of the option value. |
ThenSomeAsync<T>(bool, Task<T>)
Executes the specified task and returns an Option<T> with the result if the boolean condition is true.
Declaration
public static ValueTask<Option<T>> ThenSomeAsync<T>(this bool self, Task<T> value) where T : notnull
Parameters
Type | Name | Description |
---|---|---|
bool | self | The boolean condition. |
Task<T> | value | The task to execute. |
Returns
Type | Description |
---|---|
ValueTask<Option<T>> | An Option<T> with the result if the boolean condition is true; otherwise, the default value of Option<T>. |
Type Parameters
Name | Description |
---|---|
T | The type of the result. |
ThenSomeAsync<T>(bool, ValueTask<T>)
Executes the specified task and returns an Option<T> with the result if the boolean condition is true.
Declaration
public static ValueTask<Option<T>> ThenSomeAsync<T>(this bool self, ValueTask<T> value) where T : notnull
Parameters
Type | Name | Description |
---|---|---|
bool | self | The boolean condition. |
ValueTask<T> | value | The task to execute. |
Returns
Type | Description |
---|---|
ValueTask<Option<T>> | An Option<T> with the result if the boolean condition is true; otherwise, the default value of Option<T>. |
Type Parameters
Name | Description |
---|---|
T | The type of the result. |