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 Handle clones. This ensures efficient work-stealing across HTTP, WebSocket, and admin servers.
§Example
ⓘ
let runtime = SharedRuntime::new(num_cpus::get());
let handle = runtime.handle();
// Pass handle to subsystems
let http = HttpSubsystem::new(addr, state, handle.clone());
let ws = WsSubsystem::new(addr, state, handle.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§
Auto 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