In Rust 1.15, I have created a trait to abstract over reading & parsing file format(s). I\'m trying to create a struct which has this generic trait inside.
I hav
You probably don't want a type parameter, you want an associated type:
use std::io::Read;
trait MyReader {
type R: Read;
fn new(Self::R) -> Self;
fn into_inner(self) -> Self::R;
fn get_next(&mut self) -> Option;
fn do_thingie(&mut self);
}
struct MyIterThing<'a, T>
where T: MyReader + 'a
{
inner: &'a mut T,
}
fn main() {}
See also: