pub struct TaskIdRegistry { /* private fields */ }Expand description
Task registry for managing task metadata
Implementations§
Source§impl TaskIdRegistry
impl TaskIdRegistry
Sourcepub fn task_scope(&self, name: &str) -> TaskGuard
pub fn task_scope(&self, name: &str) -> TaskGuard
Create a task scope with automatic lifecycle management
This is the simplified API - just call this and the task is automatically completed when the guard is dropped.
§Arguments
name- Task name
§Returns
A TaskGuard that automatically completes the task when dropped
§Example
let registry = global_registry();
{
let _main = registry.task_scope("main_process");
let data = vec![1, 2, 3]; // Automatically attributed to main_process
{
let _worker = registry.task_scope("worker"); // Parent is automatically main_process
let more_data = vec![4, 5, 6]; // Automatically attributed to worker
} // worker automatically completed
} // main automatically completed
let graph = registry.export_graph();Sourcepub fn record_allocation(&self, size: usize)
pub fn record_allocation(&self, size: usize)
Sourcepub fn current_task_id() -> Option<u64>
pub fn current_task_id() -> Option<u64>
Get current task ID from thread-local cache
This is a zero-cost operation (no lock required)
Sourcepub fn get_all_tasks(&self) -> Vec<TaskMeta>
pub fn get_all_tasks(&self) -> Vec<TaskMeta>
Get all tasks
Sourcepub fn get_children(&self, parent_id: u64) -> Vec<u64>
pub fn get_children(&self, parent_id: u64) -> Vec<u64>
Sourcepub fn get_parent(&self, task_id: u64) -> Option<u64>
pub fn get_parent(&self, task_id: u64) -> Option<u64>
Sourcepub fn export_graph(&self) -> TaskGraph
pub fn export_graph(&self) -> TaskGraph
Sourcepub fn get_stats(&self) -> TaskRegistryStats
pub fn get_stats(&self) -> TaskRegistryStats
Get task statistics
Trait Implementations§
Auto Trait Implementations§
impl Freeze for TaskIdRegistry
impl RefUnwindSafe for TaskIdRegistry
impl Send for TaskIdRegistry
impl Sync for TaskIdRegistry
impl Unpin for TaskIdRegistry
impl UnsafeUnpin for TaskIdRegistry
impl UnwindSafe for TaskIdRegistry
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more