Crates.io | no_mutex |
lib.rs | no_mutex |
version | 0.0.1 |
source | src |
created_at | 2020-05-01 16:37:08.500058 |
updated_at | 2020-05-02 18:19:05.943889 |
description | A lean no_std mutex for single threaded environments |
homepage | |
repository | https://github.com/richardanaya/no_mutex |
max_upload_size | |
id | 236287 |
size | 14,490 |
** this only works on nightly **
A mutex like construct for single threaded applications.
Default
use no_mutex::Mutex;
static FOO: Mutex<Foo> = Mutex::default();
#[derive(Debug)]
struct Foo {
i:u32
}
impl Default for Foo {
fn default() -> Self {
Foo { i: 42 }
}
}
fn main() {
let r = FOO.lock();
println!("{:?}",r);
}