8 releases
| 0.1.7 | Mar 4, 2025 |
|---|---|
| 0.1.6 | Feb 8, 2025 |
#10 in #global
614 downloads per month
17KB
255 lines
Global Object Manager (GOM)
This is a simple global object manager that makes it easier for you to use global objects in Rust.
Note
You need to add crate constcat to support macro id!(...).
This is a flaw in Rust.
Example
use gom::*;
const VEC: &str = id!(Vec);
const ID: &str = id!(@VEC.Bar);
fn main() {
Registry::register(ID, vec![1, 2, 3]);
Registry::<Vec<i32>>::apply(ID, |v| {
v.push(4);
});
let v = Registry::<Vec<i32>>::remove(ID);
println!("{:?}", v);
}
Dependencies
~24KB