Show / Hide Table of Contents

Class BoolAsyncExtensions

Provides extension methods for boolean values.

Inheritance
object
BoolAsyncExtensions
Inherited Members
object.Equals(object)
object.Equals(object, object)
object.GetHashCode()
object.GetType()
object.MemberwiseClone()
object.ReferenceEquals(object, object)
object.ToString()
Namespace: RustyOptions.Async
Assembly: RustyOptions.dll
Syntax
public static class BoolAsyncExtensions

Methods

| Edit this page View Source

ThenAsync<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.

| Edit this page View Source

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.

| Edit this page View Source

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.

| Edit this page View Source

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.

  • Edit this page
  • View Source
In this article
Back to top Generated by DocFX