> > > Then nil-returning functions would need to be `Option<SomeErrorType>`. >> Having two ways to perform every I/O operation will 'infect' all code that >> uses I/O indirectly. For instance, we have a `ReaderUtil` trait that >> defines maybe two dozen methods. Do those all get duplicated? That seems >> pretty disastrous to me. >> > > That's a good point. If all higher-up IO libraries end up having to write > two versions of everything too, that's pretty bad. >
If you are worried about the implementers of such traits, you could provide default implementations of failing methods that use try_... methods internally. If you are worried about higher-level I/O abstractions, then yes, unfortunately they will have to provide both versions of each of their methods.
_______________________________________________ Rust-dev mailing list [email protected] https://mail.mozilla.org/listinfo/rust-dev
