gilbert189 — 3/7/2024, 8:07:18 AM

one of these suggestions is not like the other

♥ 7 ↩ 1 💬 4 comments

comments

theycallhermax:

iterator rust

3/7/2024, 8:13:05 PM
gilbert189:
struct Fibonacci {
    curr: u32,
    next: u32,
}

impl Iterator for Fibonacci {
    type Item = u32;

    fn next(&mut self) -> Option<Self::Item> {
        let current = self.curr;

        self.curr = self.next;
        self.next = current + self.next;

        // Since there's no endpoint to a Fibonacci sequence, the `Iterator` 
        // will never return `None`, and `Some` is always returned.
        Some(current)
    }
}
3/7/2024, 11:14:05 PM
theycallhermax:

ok

3/8/2024, 2:22:49 AM
mef:

I still find it very funny that when you search Five Pebbles the catboy version is in the first five images

3/7/2024, 1:52:11 PM