title: How can I take input from either stdin or a file if I cannot seek stdin?
body: <p>I am porting some Python to Rust as a learning exercise and need to take input from either a file or stdin. I keep a handle to my input in a struct so I thought I'd just make a <code>Box&lt;io::Read&gt;</code> but I ran into a situation where I need to seek on the input, and <code>seek</code> isn't part of the <code>Read</code> trait. I know you can't seek in pipes, so I'm going ahead and assuming for now that this method only gets called when the input is a file, but my problem is that I can't check that and downcast in Rust.</p>
  
  <p>I know that I could use an enum for the two input types, but it seems like there should be a more elegant way to do this. And that's my question, how do you do this and not make a mess?</p>
  
  <p>Is it possible to wrap stdin or a file in the same sort of buffer so I could just use that type and not worry about the type of IO?</p>