pub trait TaskInstrument:
Send
+ Sync
+ 'static {
// Required methods
fn task_created<'a>(
&self,
parent_scope: &ScopeHandle,
task: &mut AtomicFutureHandle<'a>,
);
fn scope_created(
&self,
scope_name: &str,
parent_scope: Option<&ScopeHandle>,
) -> Box<dyn Any + Send + Sync>;
}
Expand description
A trait for instrumenting the async executor.
This trait provides a way to receive callbacks for various events that occur within the executor, such as task creation, completion, and polling.
Required Methods§
Sourcefn task_created<'a>(
&self,
parent_scope: &ScopeHandle,
task: &mut AtomicFutureHandle<'a>,
)
fn task_created<'a>( &self, parent_scope: &ScopeHandle, task: &mut AtomicFutureHandle<'a>, )
Called when a new task is created.
Typically, implementers will want to call task.add_hooks()
here
to add hooks to the task.
Sourcefn scope_created(
&self,
scope_name: &str,
parent_scope: Option<&ScopeHandle>,
) -> Box<dyn Any + Send + Sync>
fn scope_created( &self, scope_name: &str, parent_scope: Option<&ScopeHandle>, ) -> Box<dyn Any + Send + Sync>
Called when scope is created
§Arguments
scope_name
: An optional name for the scope.parent_scope
: A reference to the parent scope, or None for the root.
§Returns
A boxed Any
trait object representing the created scope
which contains data that can later be retrieved from the
scope using instrument_data() on the scope.