Just a slightly alternate take.
- You might want the argument to be independent of
SourceFile
in which case;
fn new<S: io::Read>(source: S)
- This makes the function not generic over structure so leads to confusion when in generic impl struct; Could either make it a totally free function or just use some Dummy.
impl SourceFile<std::io::Empty> {
fn new<S: io::Read>(source: S) -> SourceFile<impl io::Read> {