Skip to content

Instantly share code, notes, and snippets.

@blt blt/

Last active Aug 29, 2015
What would you like to do?
fn main() {
funvsn(&mut std::io::stdio::stdin().chars());
// I'd like to make the function type here as generic as possible. All I really
// care about is getting a character iterator but I have two challenges:
// * this doesn't compile (rust 0.13.0, nightly)
// * there's a pesky std::io::IoResult in there
fn funvsn<I>(it: I) where I: Iterator<std::io::IoResult<char>> {
for c in it {
println!("{}", c);
> rustc src/
src/ 93:11 error: the trait `core::iter::Iterator<core::result::Result<char,std::io::IoError>>` is not implemented for the type `&mut std::io::Chars<'_,std::io::buffered::BufferedReader<std::io::stdio::StdReader>>`
src/ funvsn(&mut std::io::stdio::stdin().chars());
src/ 93:11 note: the trait `core::iter::Iterator` must be implemented because it is required by `funvsn`
src/ funvsn(&mut std::io::stdio::stdin().chars());
error: aborting due to previous error
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.