Skip to content

Commit

Permalink
Completed renaming of AddWatchFlags and InitFlags.
Browse files Browse the repository at this point in the history
  • Loading branch information
vdagonneau committed Feb 13, 2019
1 parent 4dca32b commit aef2227
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
6 changes: 3 additions & 3 deletions src/sys/inotify.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
//!
//! Monitor all events happening in directory "test":
//! ```no_run
//! # use nix::sys::inotify::{EventFlags,InotifyInitFlags,Inotify};
//! # use nix::sys::inotify::{AddWatchFlags,InitFlags,Inotify};
//! #
//! // We create a new inotify instance.
//! let instance = Inotify::init(InotifyInitFlags::empty()).unwrap();
//! let instance = Inotify::init(InitFlags::empty()).unwrap();
//!
//! // We add a new watch on directory "test" for all events.
//! let wd = instance.add_watch("test", EventFlags::IN_ALL_EVENTS).unwrap();
//! let wd = instance.add_watch("test", AddWatchFlags::IN_ALL_EVENTS).unwrap();
//!
//! loop {
//! // We read from our inotify instance for events.
Expand Down
20 changes: 10 additions & 10 deletions test/sys/test_inotify.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use nix::sys::inotify::{EventFlags,InotifyInitFlags,Inotify};
use nix::sys::inotify::{AddWatchFlags,InitFlags,Inotify};
use nix::Error;
use nix::errno::Errno;
use tempfile;
Expand All @@ -7,11 +7,11 @@ use std::fs::{rename, File};

#[test]
pub fn test_inotify() {
let instance = Inotify::init(InotifyInitFlags::IN_NONBLOCK)
let instance = Inotify::init(InitFlags::IN_NONBLOCK)
.unwrap();
let tempdir = tempfile::tempdir().unwrap();

instance.add_watch(tempdir.path(), EventFlags::IN_ALL_EVENTS).unwrap();
instance.add_watch(tempdir.path(), AddWatchFlags::IN_ALL_EVENTS).unwrap();

let events = instance.read_events();
assert_eq!(events.unwrap_err(), Error::Sys(Errno::EAGAIN));
Expand All @@ -24,11 +24,11 @@ pub fn test_inotify() {

#[test]
pub fn test_inotify_multi_events() {
let instance = Inotify::init(InotifyInitFlags::IN_NONBLOCK)
let instance = Inotify::init(InitFlags::IN_NONBLOCK)
.unwrap();
let tempdir = tempfile::tempdir().unwrap();

instance.add_watch(tempdir.path(), EventFlags::IN_ALL_EVENTS).unwrap();
instance.add_watch(tempdir.path(), AddWatchFlags::IN_ALL_EVENTS).unwrap();

let events = instance.read_events();
assert_eq!(events.unwrap_err(), Error::Sys(Errno::EAGAIN));
Expand All @@ -46,19 +46,19 @@ pub fn test_inotify_multi_events() {
let events = instance.read_events().unwrap();
assert_eq!(events.len(), 5);

assert_eq!(events[0].mask, EventFlags::IN_CREATE);
assert_eq!(events[0].mask, AddWatchFlags::IN_CREATE);
assert_eq!(events[0].name, Some(OsString::from("test")));

assert_eq!(events[1].mask, EventFlags::IN_OPEN);
assert_eq!(events[1].mask, AddWatchFlags::IN_OPEN);
assert_eq!(events[1].name, Some(OsString::from("test")));

assert_eq!(events[2].mask, EventFlags::IN_CLOSE_WRITE);
assert_eq!(events[2].mask, AddWatchFlags::IN_CLOSE_WRITE);
assert_eq!(events[2].name, Some(OsString::from("test")));

assert_eq!(events[3].mask, EventFlags::IN_MOVED_FROM);
assert_eq!(events[3].mask, AddWatchFlags::IN_MOVED_FROM);
assert_eq!(events[3].name, Some(OsString::from("test")));

assert_eq!(events[4].mask, EventFlags::IN_MOVED_TO);
assert_eq!(events[4].mask, AddWatchFlags::IN_MOVED_TO);
assert_eq!(events[4].name, Some(OsString::from("test2")));

assert_eq!(events[3].cookie, events[4].cookie);
Expand Down

0 comments on commit aef2227

Please sign in to comment.