]> git.lizzy.rs Git - rust.git/blob - src/test/rustdoc/spotlight-from-dependency.rs
BPF: review fixes
[rust.git] / src / test / rustdoc / spotlight-from-dependency.rs
1 #![crate_name = "foo"]
2
3 use std::iter::Iterator;
4
5 // @has foo/struct.Odd.html
6 // @has - '//h4[@id="method.new"]//span[@class="notable-traits"]//code/span' 'impl Iterator for Odd'
7 pub struct Odd {
8     current: usize,
9 }
10
11 impl Odd {
12     pub fn new() -> Odd {
13         Odd { current: 1 }
14     }
15 }
16
17 impl Iterator for Odd {
18     type Item = usize;
19
20     fn next(&mut self) -> Option<Self::Item> {
21         self.current += 2;
22         Some(self.current - 2)
23     }
24 }