pub struct ServiceHandle { /* private fields */ }Expand description
A cheap-clone handle into a running Service.
Implementations§
Source§impl ServiceHandle
impl ServiceHandle
Sourcepub fn name(&self) -> &'static str
pub fn name(&self) -> &'static str
The service’s static name (from NodeLifecycle::NAME). Empty string
if the node chose not to declare one.
Sourcepub fn request_shutdown(&self, reason: ShutdownReason)
pub fn request_shutdown(&self, reason: ShutdownReason)
Request a graceful shutdown. Idempotent.
Sourcepub fn is_running(&self) -> bool
pub fn is_running(&self) -> bool
Whether the underlying service is still running (i.e., shutdown has not been cancelled).
Sourcepub fn shutdown_token(&self) -> &ShutdownToken
pub fn shutdown_token(&self) -> &ShutdownToken
Borrow the shutdown token. Mostly useful in tests.
Sourcepub fn tasks(&self) -> Vec<TaskSummary>
pub fn tasks(&self) -> Vec<TaskSummary>
Snapshot of all currently-tracked tasks.
Trait Implementations§
Source§impl Clone for ServiceHandle
impl Clone for ServiceHandle
Source§fn clone(&self) -> ServiceHandle
fn clone(&self) -> ServiceHandle
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§
impl Freeze for ServiceHandle
impl !RefUnwindSafe for ServiceHandle
impl Send for ServiceHandle
impl Sync for ServiceHandle
impl Unpin for ServiceHandle
impl UnsafeUnpin for ServiceHandle
impl !UnwindSafe for ServiceHandle
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