pub struct SharedRuntime(/* private fields */);Expand description
Shared tokio runtime for all network subsystems.
Created once at server startup and passed to all subsystems via cloning. This ensures efficient work-stealing across HTTP, WebSocket, and admin servers.
§Example
ⓘ
let runtime = SharedRuntime::new(num_cpus::get());
// Pass cloned runtime to subsystems
let http = HttpSubsystem::new(addr, state, runtime.clone());
let ws = WsSubsystem::new(addr, state, runtime.clone());Implementations§
Sourcepub fn handle(&self) -> Handle
pub fn handle(&self) -> Handle
Get a handle for spawning tasks on this runtime.
The handle can be cloned and passed to multiple subsystems. Tasks spawned via the handle run on the shared runtime’s thread pool.
Trait Implementations§
Source§fn clone(&self) -> SharedRuntime
fn clone(&self) -> SharedRuntime
Returns a duplicate of the value. Read more
1.0.0§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§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)