How can I take input from either stdin or a file if I cannot seek stdin?
问题 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 Box<io::Read> but I ran into a situation where I need to seek on the input, and seek isn't part of the Read 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. I know