pub struct SharedRuntime(/* private fields */);Expand description
Shared runtime that can be cloned and passed across subsystems.
Platform-agnostic facade over:
- Native: tokio multi-threaded runtime + unified actor system
- WASM: Single-threaded execution
Uses Arc internally, so cloning is cheap and all clones share the same underlying runtime and actor system.
Implementations§
Sourcepub fn from_config(config: SharedRuntimeConfig) -> Self
pub fn from_config(config: SharedRuntimeConfig) -> Self
Create a new shared runtime from configuration.
§Panics
Panics if the runtime cannot be created (native only).
Sourcepub fn actor_system(&self) -> ActorSystem
pub fn actor_system(&self) -> ActorSystem
Get the unified actor system for spawning actors and compute.
Sourcepub fn handle(&self) -> Handle
pub fn handle(&self) -> Handle
Get a handle to the async runtime.
Returns a platform-specific handle type:
- Native:
tokio::runtime::Handle - WASM:
WasmHandle
Sourcepub fn spawn<F>(&self, future: F) -> JoinHandle<F::Output>
pub fn spawn<F>(&self, future: F) -> JoinHandle<F::Output>
Spawn a future onto the runtime.
Returns a platform-specific join handle type:
- Native:
tokio::task::JoinHandle - WASM:
WasmJoinHandle
Trait Implementations§
Source§fn clone(&self) -> SharedRuntime
fn clone(&self) -> SharedRuntime
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more