extern crate ringbuf_basedrop; use basedrop::Collector; use ringbuf_basedrop::RingBuffer; fn main() { let collector = Collector::new(); let rb = RingBuffer::::new(2); let (mut prod, mut cons) = rb.split(&collector.handle()); prod.push(0).unwrap(); prod.push(1).unwrap(); assert_eq!(prod.push(2), Err(2)); assert_eq!(cons.pop().unwrap(), 0); prod.push(2).unwrap(); assert_eq!(cons.pop().unwrap(), 1); assert_eq!(cons.pop().unwrap(), 2); assert_eq!(cons.pop(), None); }