diff --git a/src/collections/inner_group.rs b/src/collections/inner_group.rs
index 94bf76e..257f3cb 100644
--- a/src/collections/inner_group.rs
+++ b/src/collections/inner_group.rs
@@ -14,18 +14,18 @@ use crate::utils::{PollVec, WakerVec};
const GROUP_GROWTH_FACTOR: usize = 2;
#[pin_project::pin_project]
-pub struct InnerGroup {
+pub struct InnerGroup {
#[pin]
- pub items: Slab,
- pub wakers: WakerVec,
- pub states: PollVec,
- pub keys: BTreeSet,
+ items: Slab,
+ wakers: WakerVec,
+ states: PollVec,
+ keys: BTreeSet,
cap: usize,
len: usize,
- //_poll_behavior: PhantomData,
+ _poll_behavior: PhantomData,
}
-impl InnerGroup {
+impl InnerGroup {
pub fn with_capacity(cap: usize) -> Self {
Self {
items: Slab::with_capacity(cap),
@@ -34,7 +34,7 @@ impl InnerGroup {
keys: BTreeSet::new(),
cap,
len: 0,
- // _poll_behavior: PhantomData,
+ _poll_behavior: PhantomData,
}
}
@@ -71,6 +71,8 @@ impl InnerGroup {
}
pub fn insert_pinned(mut self: Pin<&mut Self>, item: A) -> Key {
+ // todo: less unsafe
+
if !self.has_capacity() {
let r = unsafe { &mut self.as_mut().get_unchecked_mut() };
r.resize((r.cap + 1) * GROUP_GROWTH_FACTOR);
@@ -122,23 +124,20 @@ impl InnerGroup {
pub fn can_progress_index(&self, index: usize) -> bool {
self.states[index].is_pending() && self.wakers.readiness().clear_ready(index)
}
-}
-/// Keyed operations
-impl InnerGroup {
// move to other impl block
pub fn contains_key(&self, key: Key) -> bool {
self.items.contains(key.0)
}
}
-impl Default for InnerGroup {
+impl Default for InnerGroup {
fn default() -> Self {
Self::with_capacity(0)
}
}
-impl fmt::Debug for InnerGroup {
+impl fmt::Debug for InnerGroup {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_struct("InnerGroup")
.field("cap", &self.cap)
@@ -156,60 +155,53 @@ pub struct Key(pub usize);
use theory::*;
-#[derive(Debug)]
-#[pin_project::pin_project]
-pub struct Group {
- #[pin]
- pub inner: InnerGroup,
- pub _poll_behavior: PhantomData,
-}
-
-impl Group
+impl InnerGroup
where
B: PollBehavior,
{
- pub fn poll_next_inner(self: Pin<&mut Self>, cx: &Context<'_>) -> Poll