Skip to content
Snippets Groups Projects
Commit 53ab71d5 authored by Yaroslav Dynnikov's avatar Yaroslav Dynnikov
Browse files

chore: rearrange the mailbox code

parent c7989b44
No related branches found
No related tags found
1 merge request!266Minor fixes
......@@ -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())
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment