| Crates.io | negahban |
| lib.rs | negahban |
| version | 0.3.1 |
| created_at | 2023-03-11 16:01:52.44893+00 |
| updated_at | 2023-06-03 14:36:24.081966+00 |
| description | 🧐 A simple file watcher, based on `notify`, designed to be fast, easy-to-use and async friendly |
| homepage | https://github.com/aarmn/negahban |
| repository | https://github.com/aarmn/negahban |
| max_upload_size | |
| id | 807353 |
| size | 31,806 |
🧐 A simple file watcher, based on notify, designed to be fast, easy-to-use and async friendly.
Project is alpha, it may fail at any given moment, heavily WIP
Negahban(نگهبان) is a farsi word which translates roughly to watchman/sentinel
negahban is a Rust library based on notify that allows you to watch a directory for changes.
This library is designed to be:
HookType, EventType, WatchMode, RecurseMode, WatcherMode configuration as simple to use enums.Run this in your rust project folder:
cargo add negahban
A minimal example that monitors the current directory and logs events to the console:
use negahban::{Negahban, HookType};
fn main() {
Negahban{
// fields you want to change e.g.:
hook: HookType::IndefiniteHook(
Box::new(|event| (println!("{event:#?}")))
),
..Negahban::default() // sets rest of them to default
}.watch();
}
Check the tests/ directory for more examples.
This project is licensed under the MIT License - see the LICENSE file for details.