Skip to content

Commit

Permalink
Use FnMut in blocking implementation (#5)
Browse files Browse the repository at this point in the history
  • Loading branch information
irh authored Nov 25, 2020
1 parent 9e6d36b commit 153ed7d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Unreleased

# Version 0.4.5 (2020-11-25)

- The blocking implementation of `watch` now also accepts `FnMut` instead of `Fn`.

# Version 0.4.4 (2020-11-19)

- `watch` now accepts `FnMut` instead of `Fn`
Expand Down
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hotwatch"
version = "0.4.4"
version = "0.4.5"
authors = ["Francesca Lovebloom <[email protected]>"]
edition = "2018"
description = "A Rust library for conveniently watching and handling file changes."
Expand Down
4 changes: 2 additions & 2 deletions src/blocking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ impl Default for Flow {
/// Dropping this will unwatch everything.
pub struct Hotwatch {
watcher: notify::RecommendedWatcher,
handlers: HashMap<PathBuf, Box<dyn Fn(Event) -> Flow>>,
handlers: HashMap<PathBuf, Box<dyn FnMut(Event) -> Flow>>,
rx: Receiver<Event>,
}

Expand Down Expand Up @@ -111,7 +111,7 @@ impl Hotwatch {
pub fn watch<P, F>(&mut self, path: P, handler: F) -> Result<(), Error>
where
P: AsRef<Path>,
F: 'static + Fn(Event) -> Flow,
F: 'static + FnMut(Event) -> Flow,
{
let absolute_path = path.as_ref().canonicalize()?;
self.watcher
Expand Down

0 comments on commit 153ed7d

Please sign in to comment.