Skip to content

Commit 0ab69a0

Browse files
Jonas MeerDrakulix
Jonas Meer
authored andcommitted
Add support for mio 1.0
1 parent ad2b07b commit 0ab69a0

File tree

5 files changed

+22
-5
lines changed

5 files changed

+22
-5
lines changed

.github/workflows/ci.yml

+1
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ jobs:
144144
- --no-default-features --features "mio06"
145145
- --no-default-features --features "mio07"
146146
- --no-default-features --features "mio08"
147+
- --no-default-features --features "mio10"
147148
- --no-default-features --features "hwdb"
148149
- '' # default
149150
include:

Cargo.toml

+2-1
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,11 @@ libc = "0.2"
1717
mio06 = { package = "mio", version = "^0.6.21", optional = true }
1818
mio07 = { package = "mio", version = "0.7", features = ["os-ext"], optional = true }
1919
mio08 = { package = "mio", version = "0.8", features = ["os-ext"], optional = true }
20+
mio10 = { package = "mio", version = "1.0", features = ["os-ext"], optional = true }
2021

2122
[build-dependencies]
2223
pkg-config = "0.3.3" #force a newer version for libudev-sys to fix minimal versions
2324

2425
[features]
25-
mio = ["mio08"] # mio feature defaults to the newest mio version
26+
mio = ["mio10"] # mio feature defaults to the newest mio version
2627
hwdb = []

examples/monitor.rs

+14-3
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,18 @@ extern crate mio06;
55
extern crate mio07;
66
#[cfg(feature = "mio08")]
77
extern crate mio08;
8+
#[cfg(feature = "mio10")]
9+
extern crate mio10;
810
extern crate udev;
911

1012
use std::io;
1113

12-
#[cfg(not(any(feature = "mio06", feature = "mio07", feature = "mio08")))]
14+
#[cfg(not(any(
15+
feature = "mio06",
16+
feature = "mio07",
17+
feature = "mio08",
18+
feature = "mio10"
19+
)))]
1320
mod poll {
1421
use std::io;
1522
use std::ptr;
@@ -114,20 +121,24 @@ mod poll {
114121
}
115122
}
116123

117-
#[cfg(any(feature = "mio07", feature = "mio08"))]
124+
#[cfg(any(feature = "mio07", feature = "mio08", feature = "mio10"))]
118125
mod poll {
119126
use std::io;
120127

121128
#[cfg(feature = "mio07")]
122129
use mio07::{Events, Interest, Poll, Token};
123130
#[cfg(feature = "mio08")]
124131
use mio08::{Events, Interest, Poll, Token};
132+
#[cfg(feature = "mio10")]
133+
use mio10::{Events, Interest, Poll, Token};
125134

126135
pub fn poll(mut socket: udev::MonitorSocket) -> io::Result<()> {
127136
let version = if cfg!(feature = "mio07") {
128137
"mio07"
129138
} else if cfg!(feature = "mio08") {
130139
"mio08"
140+
} else if cfg!(feature = "mio10") {
141+
"mio10"
131142
} else {
132143
"mio-unknown"
133144
};
@@ -169,7 +180,7 @@ fn print_event(event: udev::Event) {
169180
}
170181

171182
// Use `mio::poll` as poller by compile with:
172-
// `cargo run --example monitor --features "mio08"`
183+
// `cargo run --example monitor --features "mio10"`
173184
fn main() -> io::Result<()> {
174185
let socket = udev::MonitorBuilder::new()?
175186
// .match_subsystem_devtype("usb", "usb_device")?

src/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ extern crate mio06;
1313
extern crate mio07;
1414
#[cfg(feature = "mio08")]
1515
extern crate mio08;
16+
#[cfg(feature = "mio10")]
17+
extern crate mio10;
1618

1719
pub use device::{Attributes, Device, DeviceType, Properties};
1820
pub use enumerator::{Devices, Enumerator};

src/monitor.rs

+3-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ use mio06::{event::Evented, unix::EventedFd, Poll, PollOpt, Ready, Token};
1313
use mio07::{event::Source, unix::SourceFd, Interest, Registry, Token};
1414
#[cfg(feature = "mio08")]
1515
use mio08::{event::Source, unix::SourceFd, Interest, Registry, Token};
16+
#[cfg(feature = "mio10")]
17+
use mio10::{event::Source, unix::SourceFd, Interest, Registry, Token};
1618

1719
use Udev;
1820
use {ffi, util};
@@ -334,7 +336,7 @@ impl Evented for Socket {
334336
}
335337
}
336338

337-
#[cfg(any(feature = "mio07", feature = "mio08"))]
339+
#[cfg(any(feature = "mio07", feature = "mio08", feature = "mio10"))]
338340
impl Source for Socket {
339341
fn register(
340342
&mut self,

0 commit comments

Comments
 (0)