Skip to content

Commit 1188962

Browse files
committed
Remove the slab dependency
Ideally, we should have as few dependencies as possible. This change inlines most of the logic from `slab` that we used into the `ListenerSlab` struct.
1 parent 393566a commit 1188962

File tree

3 files changed

+207
-49
lines changed

3 files changed

+207
-49
lines changed

Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ std = ["parking"]
2121
[dependencies]
2222
crossbeam-utils = { version = "0.8.12", default-features = false }
2323
parking = { version = "2.0.0", optional = true }
24-
slab = { version = "0.4.7", default-features = false }
2524

2625
[dev-dependencies]
2726
waker-fn = "1"

src/lib.rs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,7 @@ use std::time::{Duration, Instant};
9292
use parking::Unparker;
9393

9494
/// An asynchronous waker or thread unparker that can be used to notify a task or thread.
95+
#[derive(Debug)]
9596
enum Task {
9697
/// A waker that can be used to notify a task.
9798
Waker(Waker),
@@ -122,8 +123,14 @@ impl Task {
122123
}
123124
}
124125

126+
impl PartialEq for Task {
127+
fn eq(&self, other: &Self) -> bool {
128+
self.as_task_ref().will_wake(other.as_task_ref())
129+
}
130+
}
131+
125132
/// A reference to a task.
126-
#[derive(Clone, Copy)]
133+
#[derive(Debug, Clone, Copy)]
127134
enum TaskRef<'a> {
128135
/// A waker that wakes up a future.
129136
Waker(&'a Waker),
@@ -749,6 +756,7 @@ impl Drop for EventListener {
749756
}
750757

751758
/// The state of a listener.
759+
#[derive(Debug, PartialEq)]
752760
pub(crate) enum State {
753761
/// It has just been created.
754762
Created,

0 commit comments

Comments
 (0)