Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/4t145/hot-sauce
https://github.com/4t145/hot-sauce
Last synced: 5 days ago
JSON representation
- Host: GitHub
- URL: https://github.com/4t145/hot-sauce
- Owner: 4t145
- Created: 2023-09-08T10:00:25.000Z (about 1 year ago)
- Default Branch: master
- Last Pushed: 2023-09-09T10:02:35.000Z (about 1 year ago)
- Last Synced: 2024-10-13T01:14:57.124Z (about 1 month ago)
- Language: Rust
- Size: 12.7 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.MD
Awesome Lists containing this project
README
# Hot-Sauce
[![Crates.io][crates-badge]][crates-url]
[![Publish][ci-publish-badge]][ci-publish-url]
[![Build][ci-build-badge]][ci-build-url][crates-badge]: https://img.shields.io/crates/v/hot-sauce.svg
[crates-url]: https://crates.io/crates/hot_sauce
[ci-publish-badge]: https://github.com/4t145/hot-sauce/actions/workflows/publish.yml/badge.svg?branch=release
[ci-publish-url]: https://github.com/4t145/hot-sauce/actions/workflows/publish.yml/?branch=release
[ci-build-badge]: https://github.com/4t145/hot-sauce/actions/workflows/rust.yml/badge.svg?branch=master
[ci-build-url]: https://github.com/4t145/hot-sauce/actions/workflows/rust.yml/?branch=masterIt's wrapper to allow you dynamic update some data like config.
You can sync the data to the newest version or get cached data of last sync, or
publish a data.```bash
cargo add hot-sauce
```## Usage
```rust
pub fn main() {
use std::thread;
let source = HotSource::::new("hello world");
let mut message = source.get();
thread::spawn(move || {
let mut version = 0;
loop {
thread::sleep(std::time::Duration::from_millis(100));
version += 1;
message.update(format!("hello world {}", version));
}
});
let mut message = source.get();
for _ in 0..10 {
thread::sleep(std::time::Duration::from_millis(50));
message.sync();
println!("{}", &**message);
}
}
```## Using `serde`
Support `serde` by enable `serde` feature
```toml
hot_sauce = { version = "*", features = ["serde"] }
```- `HotSource` can be deserialized from T
- `Hot` can be serialized into T