#[test] fn return_to_queue() { let (tx, rx) = sigq::new(); // Add "hello" tx.push("hello").unwrap(); // Add "world" tx.push("world").unwrap(); // Take out "hello" as a managed element let s = rx.pop_managed().unwrap(); assert_eq!(*s, "hello"); // Drop the managed element, which should put it back on the queue drop(s); // hello, again let s = rx.pop().unwrap(); assert_eq!(s, "hello"); } #[test] fn finalize() { let (tx, rx) = sigq::new(); // Add "hello" tx.push("hello").unwrap(); // All "world" tx.push("world").unwrap(); // Take out "hello" as a managed element let s = rx.pop_managed().unwrap(); assert_eq!(*s, "hello"); // Mark element as handled s.handled(); // next pull should yield "world" let s = rx.pop().unwrap(); assert_eq!(s, "world"); // .. and queue should be empty now assert!(rx.was_empty()); } // vim: set ft=rust et sw=2 ts=2 sts=2 cinoptions=2 tw=79 :