Expand description
ยงNegahban
๐ง 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
ยงName ๐
Negahban(ฺูฏูุจุงู) is a farsi word which translates roughly to watchman/sentinel
ยงOverview ๐
negahban is a Rust library based on notify that allows you to watch a directory for changes.
This library is designed to be:
- Simple, Sane defaults ๐ฑ
- Blazing Fast ๐
- Async friendly ๐
- Cross-platform ๐
ยงFeatures โจ
- Supports multiple event types such as file creation, deletion, and modification.
- [WIP] Provides
HookType,EventType,WatchMode,RecurseMode,WatcherModeconfiguration as simple to use enums. - Can ignore specific files and directories.
- Easy to use and async friendly.
ยงUsage ๐จ
Run this in your rust project folder:
cargo add negahbanA 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();
}ยงExamples ๐จโ๐ป
Check the tests/ directory for more examples.
ยงLicense โ
This project is licensed under the MIT License - see the LICENSE file for details.
Macrosยง
Structsยง
- Negahban
- The main struct of negahban crate
Enumsยง
- Event
Type - Determines which types of events should be passed to the hook
- Hook
Type - Determines the type of hook to be called on the chosen events occurrence
- Recurse
Mode - Indicates whether only the provided directory or its sub-directories as well should be watched
- Watcher
Mode - Determines the type of watcher used by the
notifycrate.