-
Notifications
You must be signed in to change notification settings - Fork 121
Expand file tree
/
Copy pathmod.rs
More file actions
62 lines (55 loc) · 1.46 KB
/
mod.rs
File metadata and controls
62 lines (55 loc) · 1.46 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
use std::task::Waker;
use compio_buf::BufResult;
use compio_driver::{Extra, Key, OpCode, Proactor, PushEntry};
use compio_log::instrument;
fn poll_task<T: OpCode>(
driver: &mut Proactor,
waker: &Waker,
key: Key<T>,
) -> PushEntry<Key<T>, BufResult<usize, T>> {
instrument!(compio_log::Level::DEBUG, "poll_task", ?key);
driver.pop(key).map_pending(|k| {
driver.update_waker(&k, waker);
k
})
}
fn poll_task_with_extra<T: OpCode>(
driver: &mut Proactor,
waker: &Waker,
key: Key<T>,
) -> PushEntry<Key<T>, (BufResult<usize, T>, Extra)> {
instrument!(compio_log::Level::DEBUG, "poll_task_with_extra", ?key);
driver.pop_with_extra(key).map_pending(|k| {
driver.update_waker(&k, waker);
k
})
}
fn poll_multishot<T: OpCode>(
driver: &mut Proactor,
waker: &Waker,
key: &Key<T>,
) -> Option<BufResult<usize, Extra>> {
instrument!(compio_log::Level::DEBUG, "poll_multishot", ?key);
if let Some(res) = driver.pop_multishot(key) {
return Some(res);
}
driver.update_waker(key, waker);
None
}
fn submit_raw<T: OpCode + 'static>(
driver: &mut Proactor,
op: T,
extra: Option<Extra>,
) -> PushEntry<Key<T>, BufResult<usize, T>> {
match extra {
Some(e) => driver.push_with_extra(op, e),
None => driver.push(op),
}
}
mod combinator;
#[allow(clippy::module_inception)]
mod future;
mod stream;
pub use combinator::*;
pub use future::*;
pub use stream::*;