-
Notifications
You must be signed in to change notification settings - Fork 13.6k
Closed
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Description
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?
DutchGhost and cjrh
Metadata
Metadata
Assignees
Labels
C-feature-requestCategory: A feature request, i.e: not implemented / a PR.Category: A feature request, i.e: not implemented / a PR.T-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.