mirror of
https://codeberg.org/icewind/evdev-shortcut.git
synced 2026-06-03 10:04:11 +02:00
use path instead of str
This commit is contained in:
parent
13c20f0b78
commit
aa5613a57c
1 changed files with 2 additions and 1 deletions
|
|
@ -5,6 +5,7 @@ use std::sync::mpsc::{channel, Receiver};
|
|||
use std::sync::{Arc, Mutex};
|
||||
use std::time::Duration;
|
||||
use crate::{Shortcut, DeviceOpenError, Key};
|
||||
use std::path::Path;
|
||||
|
||||
pub struct ShortcutListener {
|
||||
shortcuts: Arc<Mutex<HashSet<Shortcut>>>,
|
||||
|
|
@ -17,7 +18,7 @@ impl ShortcutListener {
|
|||
}
|
||||
}
|
||||
|
||||
pub fn listen(&self, devices: &[&str]) -> Result<Receiver<Shortcut>, DeviceOpenError> {
|
||||
pub fn listen<P: AsRef<Path>>(&self, devices: &[P]) -> Result<Receiver<Shortcut>, DeviceOpenError> {
|
||||
let mut devices = devices
|
||||
.iter()
|
||||
.map(|path| Ok(Device::open(path).map_err(|_| DeviceOpenError)?))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue