1 | #![warn(rust_2018_idioms)] |
---|---|
2 | |
3 | use bytes::Bytes; |
4 | |
5 | #[test] |
6 | fn iter_len() { |
7 | let buf = Bytes::from_static(b"hello world"); |
8 | let iter = buf.iter(); |
9 | |
10 | assert_eq!(iter.size_hint(), (11, Some(11))); |
11 | assert_eq!(iter.len(), 11); |
12 | } |
13 | |
14 | #[test] |
15 | fn empty_iter_len() { |
16 | let buf = Bytes::from_static(b""); |
17 | let iter = buf.iter(); |
18 | |
19 | assert_eq!(iter.size_hint(), (0, Some(0))); |
20 | assert_eq!(iter.len(), 0); |
21 | } |
22 |