Crates.io | singly |
lib.rs | singly |
version | 0.1.1 |
source | src |
created_at | 2024-03-12 04:37:35.862551 |
updated_at | 2024-03-12 04:59:26.892649 |
description | Lightweight "not" thread safe singleton but it depend on the usage though |
homepage | |
repository | https://github.com/UnknownRori/singly-rs |
max_upload_size | |
id | 1170104 |
size | 14,081 |
Simple, Lighweight and "not" thread safe Singleton instance but it depend on the usage, consult the docs for more information regarding thread safety, feel free to make thread safe wrapper
no_std
environmentfn main() {
// Create the Singleton instance
let mut instance = singly::Singleton::new();
/// Set the i32 type to 12
instance.set(12i32);
/// Get mutable reference i32 type and set it to 14
let a = instance.get_mut::<i32>();
*a = 14;
assert_eq!(instance.get::<i32>(), &14);
}
cargo add singly
This project is licensed under MIT