Skip to content

Instantly share code, notes, and snippets.

@alexcrichton
Created May 29, 2013 01:14
Show Gist options
  • Save alexcrichton/5667324 to your computer and use it in GitHub Desktop.
Save alexcrichton/5667324 to your computer and use it in GitHub Desktop.
fn main() {
use std::iterator::*;
let a: Counter<uint> = Counter::new(0u, 1);
let asdf: Option<uint> = a.next();
let b: Counter<uint> = Counter::new(5u, 2);
let c: TakeIterator<Counter<uint>> = a.take(3);
let b: TakeIterator<Counter<uint>> = b.take(4);
let mut c: ChainIterator<TakeIterator<Counter<uint>>,
TakeIterator<Counter<uint>>> =
c.chain::<TakeIterator<Counter<uint>>>(b);
let v: ~[uint] = c.to_vec();
assert!(v == ~[0, 2, 5, 7, 9]);
}
foo.rs:11:27: 11:69 error: cannot determine a type for this bounded type parameter: unconstrained type
foo.rs:11 c.chain::<TakeIterator<Counter<uint>>>(b);
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
fn main() {
use std::iterator::*;
let a = Counter::new(0u, 1).take(2);
let b = Counter::new(5u, 2).take(3);
let mut c = a.chain(b);
let v: ~[uint] = c.to_vec();
assert!(v == ~[0, 2, 5, 7, 9]);
}
foo.rs:6:14: 6:25 error: cannot determine a type for this bounded type parameter: unconstrained type
foo.rs:6 let mut c = a.chain(b);
^~~~~~~~~~~
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment