Skip to content

Commit

Permalink
Cut 1.0.5 release
Browse files Browse the repository at this point in the history
Latest Rust compat changes
- Send trait is an unsafe trait and cannot be derived anymore
- Change send to send_opt to get rid of panics
- Fix `unused result` warnings
- Fix errors introduced by changes to RWLock
  • Loading branch information
passcod committed Jan 3, 2015
1 parent fd78d0e commit 6f7d38a
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 12 deletions.
7 changes: 5 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,10 @@
[package]
name = "notify"
version = "1.0.4"
authors = ["Félix Saparelli <me@passcod.name>"]
version = "1.0.5"
authors = [
"Félix Saparelli <me@passcod.name>",
"Antti Keränen <detegr@gmail.com>"
]

description = "Cross-platform filesystem notification library"
homepage = "https://github.com/passcod/rsnotify"
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ _Cross-platform filesystem notification library for Rust._

```toml
[dependencies]
notify = "1"
notify = "1.0"
```

Notify uses semver, so only major versions break backward compatibility. While
Expand Down Expand Up @@ -59,7 +59,7 @@ fn main() {

## Known Bugs

- inotify backend panics when dropped
- inotify backend doesn't recurse properly (#2)
- polling backend only handles `op::WRITE`s
- see `TODO` comments in the code for more

Expand Down
6 changes: 3 additions & 3 deletions src/inotify/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fn handle_event(event: wrapper::Event, tx: &Sender<Event>, paths: &Arc<RWLock<Ha

let path = match event.name.is_empty() {
true => {
match (*paths).read().get(&event.wd) {
match (*paths).read().unwrap().get(&event.wd) {
Some(p) => Some(p.clone()),
None => None
}
Expand Down Expand Up @@ -120,7 +120,7 @@ impl Watcher for INotifyWatcher {
Ok(w) => {
watching.remove(flags::IN_MASK_ADD);
self.watches.insert(path.clone(), (w.clone(), watching));
(*self.paths).write().insert(w.clone(), path.clone());
(*self.paths).write().unwrap().insert(w.clone(), path.clone());
Ok(())
}
}
Expand All @@ -136,7 +136,7 @@ impl Watcher for INotifyWatcher {
Ok(_) => {
// Nothing depends on the value being gone
// from here now that inotify isn't watching.
(*self.paths).write().remove(w);
(*self.paths).write().unwrap().remove(w);
Ok(())
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/poll.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ impl PollWatcher {
// TODO: DRY it up
let mut mtimes: HashMap<Path, u64> = HashMap::new();
loop {
if !(*open.read()) {
if !(*open.read().unwrap()) {
break
}

for watch in watches.read().iter() {
for watch in watches.read().unwrap().iter() {
if !watch.exists() {
tx.send(Event {
path: Some(watch.clone()),
Expand Down Expand Up @@ -117,12 +117,12 @@ impl Watcher for PollWatcher {
}

fn watch(&mut self, path: &Path) -> Result<(), Error> {
(*self.watches).write().insert(path.clone());
(*self.watches).write().unwrap().insert(path.clone());
Ok(())
}

fn unwatch(&mut self, path: &Path) -> Result<(), Error> {
if (*self.watches).write().remove(path) {
if (*self.watches).write().unwrap().remove(path) {
Ok(())
} else {
Err(Error::WatchNotFound)
Expand All @@ -133,7 +133,7 @@ impl Watcher for PollWatcher {
impl Drop for PollWatcher {
fn drop(&mut self) {
{
let mut open = (*self.open).write();
let mut open = (*self.open).write().unwrap();
(*open) = false;
}
}
Expand Down

0 comments on commit 6f7d38a

Please sign in to comment.