2021-02-14 07:47:55 -06:00
|
|
|
#![crate_name = "foo"]
|
|
|
|
|
|
|
|
use std::iter::Iterator;
|
|
|
|
|
|
|
|
// @has foo/struct.Odd.html
|
2022-11-08 18:49:29 -06:00
|
|
|
// @has - '//*[@id="method.new"]//a[@class="notable-traits"]/@data-ty' 'Odd'
|
2022-11-07 16:53:30 -06:00
|
|
|
// @snapshot odd - '//script[@id="notable-traits-data"]'
|
2021-02-14 07:47:55 -06:00
|
|
|
pub struct Odd {
|
|
|
|
current: usize,
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Odd {
|
|
|
|
pub fn new() -> Odd {
|
|
|
|
Odd { current: 1 }
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
impl Iterator for Odd {
|
|
|
|
type Item = usize;
|
|
|
|
|
|
|
|
fn next(&mut self) -> Option<Self::Item> {
|
|
|
|
self.current += 2;
|
|
|
|
Some(self.current - 2)
|
|
|
|
}
|
|
|
|
}
|