Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PollWatcher: unify signature of new and with_delay #360

Merged
merged 1 commit into from Sep 29, 2021

Conversation

jhscheer
Copy link
Contributor

  • Move event_handler logic from new to with_delay to be able to call:
let (tx, rx) = std::sync::mpsc::channel();
let mut watcher = PollWatcher::with_delay(tx, Duration::from_secs(1))?;

instead of:

let (tx, rx) = std::sync::mpsc::channel();
let mut watcher = PollWatcher::with_delay(Arc::new(Mutex::new(tx)), Duration::from_secs(1))?;
  • Add documentation

* Move `event_handler` logic from `new` to `with_delay` to be able to call:
```rust
let (tx, rx) = std::sync::mpsc::channel();
let mut watcher = PollWatcher::with_delay(tx, Duration::from_secs(1))?;
```
instead of:
```rust
let (tx, rx) = std::sync::mpsc::channel();
let mut watcher = PollWatcher::with_delay(Arc::new(Mutex::new(tx)), Duration::from_secs(1))?;
```

* Add documentation
Copy link
Member

@0xpr03 0xpr03 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, I thought a bit about whether we may want to allow passing an Arc inside, but ultimately we already do the same thing for other backends..

@0xpr03 0xpr03 merged commit ff1a64c into notify-rs:main Sep 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants