Module lightproc::lightproc [−][src]
Expand description
Lightweight process implementation which enables users to create either panic recoverable process or ordinary process.
Lightweight processes needs a stack to use their lifecycle
operations like before_start
, after_complete
and more…
Example Usage
use lightproc::prelude::*;
// ... future that does work
let future = async {
println!("Doing some work");
};
// ... basic schedule function with no waker logic
fn schedule_function(proc: LightProc) {;}
// ... process stack with a lifecycle callback
let proc_stack =
ProcStack::default()
.with_after_panic(|s: &mut EmptyProcState| {
println!("After panic started!");
});
// ... creating a recoverable process
let panic_recoverable = LightProc::recoverable(
future,
schedule_function,
proc_stack
);
Structs
Struct to create and operate lightweight processes