Skip to content

Instantly share code, notes, and snippets.

Created Jan 18, 2018

What would you like to do?
Rust code shared from the playground
use std::ops::Add;
pub struct SomeStruct<T> {
a: T,
b: T,
impl<T: Add<Output = T>> Iterator for SomeStruct<T> {
type Item = T;
fn next(&mut self) -> Option<Self::Item> {
let res: T = self.b + self.b;
fn main() {
println!("{}", (SomeStruct { a: 4, b: 9 }).next().unwrap());
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.