Some types (net:TcpStream and fs:File in particular) implement io::Read and io::Write on &'a T. If one of these types are wrapped in an Arc (or Rc), there is no real reason why one shouldn't be able to call Read or Write methods on it. For example, this code should compile:
let mut x = Arc::new(TcpStream::connect("127.0.0.1:80")?);
x.read(&mut [0; 32])?;
I think this can be implemented pretty straightforwardly by adding the following impls to Arc and Rc:
impl<'a, T> io::Read for Arc<T> where &'a T: io::Read { .. }
impl<'a, T> io::Write for Arc<T> where &'a T: io::Write { .. }
Are there good reasons for why impls like these shouldn't be added?
Some types (
net:TcpStreamandfs:Filein particular) implementio::Readandio::Writeon&'a T. If one of these types are wrapped in anArc(orRc), there is no real reason why one shouldn't be able to callReadorWritemethods on it. For example, this code should compile:I think this can be implemented pretty straightforwardly by adding the following impls to
ArcandRc:Are there good reasons for why impls like these shouldn't be added?