#inotify #fibers #future #friendly #events #directory #inotify-service

fibers_inotify

A futures friendly inotify wrapper for fibers crate

3 releases

Uses old Rust 2015

0.1.2 Dec 20, 2022
0.1.1 Jan 12, 2018
0.1.0 Jan 10, 2018

#1762 in Asynchronous

MIT license

26KB
554 lines

fibers_inotify

fibers_inotify Documentation Build Status Code Coverage License: MIT

A futures friendly inotify wrapper for fibers crate.

Documentation.

Examples

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();

Dependencies

~3MB
~60K SLoC