Rename Filter to NotificationFilter

This commit is contained in:
Matt Green 2016-09-23 13:52:50 -06:00
parent 0747d643c1
commit 0892da59e2
2 changed files with 8 additions and 8 deletions

View File

@ -2,7 +2,7 @@ extern crate clap;
extern crate libc;
extern crate notify;
mod filter;
mod notification_filter;
use std::ffi::CString;
use std::sync::mpsc::{channel, Receiver, RecvError};
@ -13,7 +13,7 @@ use clap::{App, Arg};
use libc::system;
use notify::{Event, RecommendedWatcher, Watcher};
use filter::Filter;
use notification_filter::NotificationFilter;
fn clear() {
// TODO: determine better way to do this
@ -36,7 +36,7 @@ fn invoke(cmd: &str) {
}
}
fn wait(rx: &Receiver<Event>, filter: &Filter, verbose: bool) -> Result<Event, RecvError> {
fn wait(rx: &Receiver<Event>, filter: &NotificationFilter, verbose: bool) -> Result<Event, RecvError> {
loop {
// Block on initial notification
let e = try!(rx.recv());
@ -114,7 +114,7 @@ fn main() {
let verbose = args.is_present("verbose");
let cwd = env::current_dir().unwrap();
let mut filter = Filter::new(&cwd);
let mut filter = NotificationFilter::new(&cwd);
// Ignore python bytecode and dotted directories by default
let default_filters = vec!["*.pyc", ".*/*"];

View File

@ -4,15 +4,15 @@ use std::path::{Path,PathBuf};
use self::glob::{Pattern,PatternError};
pub struct Filter {
pub struct NotificationFilter {
cwd: PathBuf,
filters: Vec<Pattern>,
ignores: Vec<Pattern>
}
impl Filter {
pub fn new(current_dir: &Path) -> Filter {
Filter {
impl NotificationFilter {
pub fn new(current_dir: &Path) -> NotificationFilter {
NotificationFilter {
cwd: current_dir.to_path_buf(),
filters: vec![],
ignores: vec![]