-
Notifications
You must be signed in to change notification settings - Fork 12.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Provide Read and Write access through Arc<T> if &T: Read/Write #53835
Labels
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
Comments
memoryruins
added
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
labels
Sep 15, 2018
tbu-
added a commit
to tbu-/rust
that referenced
this issue
Mar 8, 2022
If `&T` implements these traits, `Arc<T>` has no reason not to do so either. This is useful for operating system handles like `File` or `TcpStream` which don't need a mutable reference to implement these traits. Fix rust-lang#53835.
Closing because generic impls like proposed won't behave correctly, as described in #94744. |
tbu-
added a commit
to tbu-/rust
that referenced
this issue
Jun 23, 2023
If `&T` implements these traits, `Arc<T>` has no reason not to do so either. This is useful for operating system handles like `File` or `TcpStream` which don't need a mutable reference to implement these traits. CC rust-lang#53835. CC rust-lang#94744.
TaKO8Ki
added a commit
to TaKO8Ki/rust
that referenced
this issue
Jun 27, 2023
Add `Read`, `Write` and `Seek` impls for `Arc<File>` where appropriate If `&T` implements these traits, `Arc<T>` has no reason not to do so either. This is useful for operating system handles like `File` or `TcpStream` which don't need a mutable reference to implement these traits. CC rust-lang#53835. CC rust-lang#94744.
bors
added a commit
to rust-lang-ci/rust
that referenced
this issue
Jul 10, 2023
Add `Read`, `Write` and `Seek` impls for `Arc<File>` where appropriate If `&T` implements these traits, `Arc<T>` has no reason not to do so either. This is useful for operating system handles like `File` or `TcpStream` which don't need a mutable reference to implement these traits. CC rust-lang#53835. CC rust-lang#94744.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
C-feature-request
Category: A feature request, i.e: not implemented / a PR.
T-libs-api
Relevant to the library API team, which will review and decide on the PR/issue.
Some types (
net:TcpStream
andfs:File
in particular) implementio::Read
andio::Write
on&'a T
. If one of these types are wrapped in anArc
(orRc
), there is no real reason why one shouldn't be able to callRead
orWrite
methods on it. For example, this code should compile:I think this can be implemented pretty straightforwardly by adding the following impls to
Arc
andRc
:Are there good reasons for why impls like these shouldn't be added?
The text was updated successfully, but these errors were encountered: