]>
git.proxmox.com Git - rustc.git/blob - tests/ui/issues/issue-22036.rs
3 trait DigitCollection
: Sized
{
4 type Iter
: Iterator
<Item
= u8>;
5 fn digit_iter(self) -> Self::Iter
;
7 fn digit_sum(self) -> u32 {
9 .map(|digit
: u8| digit
as u32)
10 .fold(0, |sum
, digit
| sum
+ digit
)
14 impl<I
> DigitCollection
for I
where I
: Iterator
<Item
=u8> {
17 fn digit_iter(self) -> I
{
23 let xs
= vec
![1, 2, 3, 4, 5];
24 assert_eq
!(xs
.into_iter().digit_sum(), 15);