1
0
mirror of https://github.com/fafhrd91/actix-net synced 2025-06-27 06:09:02 +02:00

add System::try_current (#275)

This commit is contained in:
Rob Ede
2021-02-06 22:45:03 +00:00
committed by GitHub
parent eb4d29e15e
commit 32543809f9
3 changed files with 21 additions and 0 deletions

View File

@ -100,6 +100,15 @@ impl System {
})
}
/// Try to get current running system.
///
/// Returns `None` if no System has been started.
///
/// Contrary to `current`, this never panics.
pub fn try_current() -> Option<System> {
CURRENT.with(|cell| cell.borrow().clone())
}
/// Get handle to a the System's initial [Arbiter].
pub fn arbiter(&self) -> &ArbiterHandle {
&self.arbiter_handle