https://github.com/unknownrori/singly-rs
Simple, Lighweight and "not" thread safe Singleton instance but it's depend on the usage
https://github.com/unknownrori/singly-rs
nostd rust-lang singleton
Last synced: 4 months ago
JSON representation
Simple, Lighweight and "not" thread safe Singleton instance but it's depend on the usage
- Host: GitHub
- URL: https://github.com/unknownrori/singly-rs
- Owner: UnknownRori
- License: mit
- Created: 2024-03-12T04:35:46.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-03-12T05:01:25.000Z (over 1 year ago)
- Last Synced: 2025-03-07T17:04:39.054Z (4 months ago)
- Topics: nostd, rust-lang, singleton
- Language: Rust
- Homepage: https://docs.rs/singly
- Size: 13.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Singly
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## Features
* Set value to the instance with type.
* Get reference value to the instance with type.
* Get mutable reference value to the instance with type.
* Work at `no_std` environment## Examples
```rs
fn 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::();
*a = 14;assert_eq!(instance.get::(), &14);
}
```## Installation
```sh
cargo add singly
```## License
This project is licensed under MIT