This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use std::collections::VecDeque; | |
use std::sync::{Arc, Condvar, Mutex}; | |
// Flavors: | |
// - Synchronous channels: Channel where send() can block. Limited capacity. | |
// - Mutex + Condvar + VecDeque | |
// - Atomic VecDeque (atomic queue) + thread::park + thread::Thread::notify | |
// - Asynchronous channels: Channel where send() cannot block. Unbounded. | |
// - Mutex + Condvar + VecDeque | |
// - Mutex + Condvar + LinkedList |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
pub trait IteratorExt: Iterator + Sized { | |
fn our_flatten(self) -> Flatten<Self> | |
where | |
Self::Item: IntoIterator; | |
} | |
impl<T> IteratorExt for T | |
where | |
T: Iterator, | |
{ | |
fn our_flatten(self) -> Flatten<Self> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#[macro_export] | |
macro_rules! avec { | |
($($element:expr),*) => {{ | |
// check that count is const | |
const C: usize = $crate::count![@COUNT; $($element),*]; | |
#[allow(unused_mut)] | |
let mut vs = Vec::with_capacity(C); | |
$(vs.push($element);)* | |
vs |