From 53ab71d55b97188bc4cb2081820ca6904121fd95 Mon Sep 17 00:00:00 2001 From: Yaroslav Dynnikov <yaroslav.dynnikov@gmail.com> Date: Sat, 1 Oct 2022 01:20:04 +0300 Subject: [PATCH] chore: rearrange the mailbox code --- src/mailbox.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/mailbox.rs b/src/mailbox.rs index dadeafaeed..9dc762920b 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()) -- GitLab