diff --git a/src/mailbox.rs b/src/mailbox.rs index dadeafaeeda7c695e727854c4a53c0ba013f2c2a..9dc762920ba17b4b0899c7c361e3de2c7ff18024 100644 --- a/src/mailbox.rs +++ b/src/mailbox.rs @@ -10,11 +10,6 @@ use std::cell::RefCell; use std::rc::Rc; use std::time::Duration; -struct Inner<T> { - cond: Rc<fiber::Cond>, - content: RefCell<Vec<T>>, -} - /// An inter-fiber communication channel based on `Vec<T>`. /// /// One can send messages one by one, transferring the ownership. @@ -53,9 +48,14 @@ struct Inner<T> { /// // Won't ever yield. /// assert_eq!(mailbox.try_receive_all(), vec![]); /// ``` -/// + pub struct Mailbox<T>(Rc<Inner<T>>); +struct Inner<T> { + cond: Rc<fiber::Cond>, + content: RefCell<Vec<T>>, +} + impl<T> Clone for Mailbox<T> { fn clone(&self) -> Self { Self(self.0.clone())