Skip to main content

task_callbacks

Function task_callbacks 

Source
pub unsafe fn task_callbacks<FBefore, FEnter, FExit, FAfter>(
    f_before: FBefore,
    f_enter: FEnter,
    f_exit: FExit,
    f_after: FAfter,
)
where FBefore: Fn() -> Option<*const ()> + 'static + Sync, FEnter: Fn(*const ()) -> *const () + 'static + Sync, FExit: Fn(*const ()) + 'static + Sync, FAfter: Fn(*const ()) + 'static + Sync,
Expand description

ยงSafety

The user must ensure that the pointer returned by before has a 'static lifetime. This pointer will be owned by the spawned task for the duration of that task, and ownership will be returned to the user at the end of the task via after. The pointer remains opaque to the runtime.

Does nothing if task callbacks have already been set, use task_opt_callbacks to check whether they were set.