mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat: add TaskManager::current (#5900)
This commit is contained in:
@ -162,6 +162,16 @@ pub struct TaskManager {
|
||||
// === impl TaskManager ===
|
||||
|
||||
impl TaskManager {
|
||||
/// Returns a a [TaskManager] over the currently running Runtime.
|
||||
///
|
||||
/// # Panics
|
||||
///
|
||||
/// This will panic if called outside the context of a Tokio runtime.
|
||||
pub fn current() -> Self {
|
||||
let handle = Handle::current();
|
||||
Self::new(handle)
|
||||
}
|
||||
|
||||
/// Create a new instance connected to the given handle's tokio runtime.
|
||||
pub fn new(handle: Handle) -> Self {
|
||||
let (panicked_tasks_tx, panicked_tasks_rx) = unbounded_channel();
|
||||
|
||||
Reference in New Issue
Block a user