Clio develop
The XRP Ledger API server.
Loading...
Searching...
No Matches
util::async::AnyOperation< RetType > Class Template Reference

A type-erased operation that can be executed via AnyExecutionContext. More...

#include <AnyOperation.hpp>

Public Member Functions

 AnyOperation (impl::ErasedOperation &&operation)
 Construct a new type-erased Operation object.
 
 AnyOperation (AnyOperation const &)=delete
 
 AnyOperation (AnyOperation &&)=default
 
AnyOperationoperator= (AnyOperation const &)=delete
 
AnyOperationoperator= (AnyOperation &&)=default
 
void wait () noexcept
 Wait for the operation to complete.
 
void abort () noexcept
 Abort the operation.
 
std::expected< RetType, ExecutionErrorget ()
 Get the result of the operation.
 

Detailed Description

template<typename RetType>
class util::async::AnyOperation< RetType >

A type-erased operation that can be executed via AnyExecutionContext.

Constructor & Destructor Documentation

◆ AnyOperation()

template<typename RetType >
util::async::AnyOperation< RetType >::AnyOperation ( impl::ErasedOperation && operation)
inline

Construct a new type-erased Operation object.

Parameters
operationThe operation to wrap

Member Function Documentation

◆ abort()

template<typename RetType >
void util::async::AnyOperation< RetType >::abort ( )
inlinenoexcept

Abort the operation.

Used to cancel the timer for scheduled operations and request the operation to be stopped as soon as possible

◆ get()

template<typename RetType >
std::expected< RetType, ExecutionError > util::async::AnyOperation< RetType >::get ( )
inlinenodiscard

Get the result of the operation.

Returns
The result of the operation

◆ wait()

template<typename RetType >
void util::async::AnyOperation< RetType >::wait ( )
inlinenoexcept

Wait for the operation to complete.

Note
This will block the current thread until the operation is complete

The documentation for this class was generated from the following file: