pub struct RuntimeBuilder { /* private fields */ }Expand description
Builder for a bounded multicarrier runtime.
Construction starts carriers + blocking_threads + 2 OS threads: affine carriers,
native workers, one readiness driver, and one shutdown coordinator (five by default).
One process-wide lifecycle owner is shared. Coordinator/owner stacks request 256 KiB;
other native stacks use platform defaults. The owner polls completions every 10 ms.
One root may run at a time; supervisors and local task groups reuse these threads.
crate::lifecycle::LIFECYCLE_CAPACITY limits retained lifecycles to 256. A full table
returns Error::Capacity with crate::error::CapacityResource::Lifecycles; a failed
process owner returns Error::LifecycleFailed before runtime workers start.
Implementations§
Source§impl RuntimeBuilder
impl RuntimeBuilder
Sourcepub fn io_capacity(self, capacity: usize) -> Self
pub fn io_capacity(self, capacity: usize) -> Self
Bounds readiness waits across this runtime.
Sourcepub fn blocking_threads(self, threads: usize) -> Self
pub fn blocking_threads(self, threads: usize) -> Self
Sets a positive dedicated native worker count.
Sourcepub fn blocking_capacity(self, capacity: usize) -> Self
pub fn blocking_capacity(self, capacity: usize) -> Self
Bounds queued, running, completed-but-unclaimed and native-disposal jobs combined.
Sourcepub fn task_local_capacity(self, capacity: usize) -> Self
pub fn task_local_capacity(self, capacity: usize) -> Self
Bounds initialized task-local keys per virtual thread.
Sourcepub fn carriers(self, count: usize) -> Self
pub fn carriers(self, count: usize) -> Self
Sets the number of persistent carriers; started tasks never migrate.
Sourcepub fn carrier_queue_capacity(self, capacity: usize) -> Self
pub fn carrier_queue_capacity(self, capacity: usize) -> Self
Sets the bounded unstarted-packet capacity of each carrier inbox.
Sourcepub fn stall_policy(self, policy: StallPolicy) -> Self
pub fn stall_policy(self, policy: StallPolicy) -> Self
Chooses disabled, report-only, or explicit abort behavior for inactive root scopes.
Sourcepub fn max_vthreads(self, limit: usize) -> Self
pub fn max_vthreads(self, limit: usize) -> Self
Bounds live tasks and unobserved completions; joined records may be evicted. The owned-scope limit follows this final value unless explicitly overridden.
Sourcepub fn max_owned_scopes(self, limit: usize) -> Self
pub fn max_owned_scopes(self, limit: usize) -> Self
Bounds roots and supervisors independently; must be positive.
When omitted, this follows the final max_vthreads, regardless of builder order.
Sourcepub fn stack_size(self, bytes: usize) -> Self
pub fn stack_size(self, bytes: usize) -> Self
Sets the requested stack capacity per virtual thread.
Sourcepub fn stack_cache_capacity(self, capacity: usize) -> Self
pub fn stack_cache_capacity(self, capacity: usize) -> Self
Sets the number of completed stacks retained per carrier.
Sourcepub fn evidence_capacity(self, capacity: usize) -> Self
pub fn evidence_capacity(self, capacity: usize) -> Self
Enables a bounded, nonblocking runtime evidence stream.
Sourcepub fn build(self) -> Result<Runtime>
pub fn build(self) -> Result<Runtime>
Validates the configuration and constructs a runtime.
Native/OS initialization, including readiness startup, has no elapsed-time bound.
Use a process-level startup watchdog where bounded service startup is required.
Explicitly rolls back partial initialization. Returns the construction error
directly if cleanup succeeds, or Error::ConstructionFailed with both causes.