()
| 384 | |
| 385 | #[test] |
| 386 | fn drain_into_batch() { |
| 387 | let (mut tx, mut rx) = RingBuffer::channel::<u64>(16); |
| 388 | |
| 389 | for i in 0..10 { |
| 390 | tx.try_push(i).unwrap(); |
| 391 | } |
| 392 | |
| 393 | let mut buf = Vec::new(); |
| 394 | let drained = rx.drain_into(&mut buf, 5); |
| 395 | assert_eq!(drained, 5); |
| 396 | assert_eq!(buf, vec![0, 1, 2, 3, 4]); |
| 397 | |
| 398 | let drained = rx.drain_into(&mut buf, 100); |
| 399 | assert_eq!(drained, 5); |
| 400 | assert_eq!(buf, vec![0, 1, 2, 3, 4, 5, 6, 7, 8, 9]); |
| 401 | } |
| 402 | |
| 403 | #[test] |
| 404 | fn disconnect_detection_producer_drops() { |
nothing calls this directly
no test coverage detected