task_callbacks

Function task_callbacks 

Source
pub unsafe fn task_callbacks<FBefore, FEnter, FExit, FAfter>(
    before: FBefore,
    enter: FEnter,
    exit: FExit,
    after: FAfter,
)
where FBefore: Fn() -> Option<*const ()> + 'static, FEnter: Fn(*const ()) -> *const () + 'static, FExit: Fn(*const ()) + 'static, FAfter: Fn(*const ()) + 'static,
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.

§Panics

Panics if task callbacks have already been set.