Crates.io | fibers_inotify |
lib.rs | fibers_inotify |
version | 0.1.2 |
source | src |
created_at | 2018-01-10 17:31:39.442522 |
updated_at | 2022-12-20 00:37:16.30298 |
description | A futures friendly inotify wrapper for fibers crate |
homepage | https://github.com/sile/fibers_inotify |
repository | https://github.com/sile/fibers_inotify |
max_upload_size | |
id | 46255 |
size | 38,001 |
A futures friendly inotify wrapper for fibers crate.
Watches /tmp
directory:
use fibers::{Executor, InPlaceExecutor, Spawn};
use fibers_inotify::{InotifyService, WatchMask};
use futures::{Future, Stream};
let inotify_service = InotifyService::new();
let inotify_handle = inotify_service.handle();
let mut executor = InPlaceExecutor::new().unwrap();
executor.spawn(inotify_service.map_err(|e| panic!("{}", e)));
let fiber = executor.spawn_monitor(
inotify_handle
.watch("/tmp/", WatchMask::CREATE | WatchMask::DELETE)
.for_each(|event| Ok(println!("# EVENT: {:?}", event)))
.map_err(|e| panic!("{}", e)),
);
let _ = executor.run_fiber(fiber).unwrap();