Created
May 29, 2013 01:14
-
-
Save alexcrichton/5667324 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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]); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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