Skip to main content

RuntimeBuilder

Struct RuntimeBuilder 

Source
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

Source

pub fn io_capacity(self, capacity: usize) -> Self

Bounds readiness waits across this runtime.

Source

pub fn blocking_threads(self, threads: usize) -> Self

Sets a positive dedicated native worker count.

Source

pub fn blocking_capacity(self, capacity: usize) -> Self

Bounds queued, running, completed-but-unclaimed and native-disposal jobs combined.

Source

pub fn task_local_capacity(self, capacity: usize) -> Self

Bounds initialized task-local keys per virtual thread.

Source

pub fn carriers(self, count: usize) -> Self

Sets the number of persistent carriers; started tasks never migrate.

Source

pub fn carrier_queue_capacity(self, capacity: usize) -> Self

Sets the bounded unstarted-packet capacity of each carrier inbox.

Source

pub fn stall_policy(self, policy: StallPolicy) -> Self

Chooses disabled, report-only, or explicit abort behavior for inactive root scopes.

Source

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.

Source

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.

Source

pub fn stack_size(self, bytes: usize) -> Self

Sets the requested stack capacity per virtual thread.

Source

pub fn stack_cache_capacity(self, capacity: usize) -> Self

Sets the number of completed stacks retained per carrier.

Source

pub fn evidence_capacity(self, capacity: usize) -> Self

Enables a bounded, nonblocking runtime evidence stream.

Source

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.

Trait Implementations§

Source§

impl Clone for RuntimeBuilder

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for RuntimeBuilder

Source§

impl Debug for RuntimeBuilder

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for RuntimeBuilder

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.