cortex 0.0.1
Loading...
Searching...
No Matches
cortex::Coroutine::Builder Struct Reference

A builder class for creating Coroutine instances with custom configuration. More...

#include <coroutine.hpp>

Public Member Functions

 Builder ()
 Default constructor for Builder.
 
Coroutine Build (CoroutineBody body) &&
 Builds and returns a new Coroutine instance.
 
Builder SetStackSizeInBytes (std::size_t stack_size_bytes) &&noexcept
 Sets the stack size for the coroutine to be built.
 
Builder SetMemoryResource (MemoryResourceSharedPtr resource) &&noexcept
 Sets the memory resource for the coroutine to be built.
 

Detailed Description

A builder class for creating Coroutine instances with custom configuration.

The Builder allows setting the stack size and memory resource before constructing the coroutine.

Constructor & Destructor Documentation

◆ Builder()

cortex::Coroutine::Builder::Builder ( )

Default constructor for Builder.

Initializes with default stack size (256KB) and default memory resource.

Member Function Documentation

◆ Build()

Coroutine cortex::Coroutine::Builder::Build ( CoroutineBody  body) &&

Builds and returns a new Coroutine instance.

Parameters
bodyThe function or callable to execute within the coroutine.
Returns
A new Coroutine instance.
Exceptions
std::invalid_argumentif the body is empty or stack_size_bytes is 0 or resource is null.

◆ SetMemoryResource()

Builder cortex::Coroutine::Builder::SetMemoryResource ( MemoryResourceSharedPtr  resource) &&
noexcept

Sets the memory resource for the coroutine to be built.

Parameters
resourceThe memory resource to use.
Returns
The builder instance for chaining.

◆ SetStackSizeInBytes()

Builder cortex::Coroutine::Builder::SetStackSizeInBytes ( std::size_t  stack_size_bytes) &&
noexcept

Sets the stack size for the coroutine to be built.

Parameters
stack_size_bytesThe size of the stack in bytes.
Returns
The builder instance for chaining.

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