caniuse_serde/StatusIterator.rs
1// This file is part of caniuse-serde. It is subject to the license terms in the COPYRIGHT file found in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/caniuse-serde/master/COPYRIGHT. No part of predicator, including this file, may be copied, modified, propagated, or distributed except according to the terms contained in the COPYRIGHT file.
2// Copyright © 2017 The developers of caniuse-serde. See the COPYRIGHT file in the top-level directory of this distribution and at https://raw.githubusercontent.com/lemonrock/caniuse-serde/master/COPYRIGHT.
3
4
5/// A struct that exists to workaround Rust's lack (yet) of 'impl Trait'
6#[derive(Debug, Clone)]
7pub struct StatusIterator<'a>(Keys<'a, Status, String>);
8
9impl<'a> Iterator for StatusIterator<'a>
10{
11 type Item = &'a Status;
12
13 /// Returns the next AgentName object.
14 #[inline(always)]
15 fn next(&mut self) -> Option<Self::Item>
16 {
17 self.0.next()
18 }
19}
20
21impl<'a> ExactSizeIterator for StatusIterator<'a>
22{
23 /// Returns the exact number of times the iterator will iterate.
24 #[inline(always)]
25 fn len(&self) -> usize
26 {
27 self.0.len()
28 }
29}