Crates.io | rusty-scheduler |
lib.rs | rusty-scheduler |
version | 0.1.1 |
source | src |
created_at | 2021-11-17 01:41:54.289501 |
updated_at | 2021-11-17 01:49:41.495844 |
description | A single threaded closure and function scheduler |
homepage | |
repository | |
max_upload_size | |
id | 483074 |
size | 3,969 |
A single threaded closure and function scheduler in Rust.
use rusty_scheduler::Scheduler;
let schedular = Scheduler::new();
let x = 1;
schedular.defer(move || {
let y = 2;
assert_eq!(x + y, 3);
});
schedular.defer(|| {
assert_eq!(1, 1);
});
schedular.run();
This will run the first closure first, then the second closure when run is called.
This is a project to help me understand Rust and Cargo. I originally wanted to use this without the standerd library (so I could run it on microcontrollers), but that is beyond my capibilites for the moment. I may revisit and continue this in the future.