pub struct Handle { /* private fields */ }
Available on
madsim
only.Expand description
Supervisor handle to the runtime.
Implementations§
source§impl Handle
impl Handle
sourcepub fn seed(&self) -> u64
pub fn seed(&self) -> u64
Returns the random seed of the current runtime.
use madsim::{Config, runtime::Runtime};
let rt = Runtime::with_seed_and_config(2333, Config::default());
assert_eq!(rt.handle().seed(), 2333);
sourcepub fn kill(&self, id: impl ToNodeId)
pub fn kill(&self, id: impl ToNodeId)
Kill a node.
- All tasks spawned on this node will be killed immediately.
- All data that has not been flushed to the disk will be lost.
sourcepub fn send_ctrl_c(&self, id: impl ToNodeId)
pub fn send_ctrl_c(&self, id: impl ToNodeId)
Send a Ctrl+C signal to the node.
sourcepub fn create_node(&self) -> NodeBuilder<'_>
pub fn create_node(&self) -> NodeBuilder<'_>
Create a node which will be bound to the specified address.
sourcepub fn get_node(&self, id: impl ToNodeId) -> Option<NodeHandle>
pub fn get_node(&self, id: impl ToNodeId) -> Option<NodeHandle>
Return a handle of the specified node.
sourcepub fn metrics(&self) -> RuntimeMetrics
pub fn metrics(&self) -> RuntimeMetrics
Returns a view that lets you get information about how the runtime is performing.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Handle
impl !RefUnwindSafe for Handle
impl Send for Handle
impl Sync for Handle
impl Unpin for Handle
impl !UnwindSafe for Handle
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.