Skip to content

Some implementations of Write should implement Write for an immutable reference as well #73836

Closed
@nagisa

Description

@nagisa

The implementations of Write which are MT-safe under the covers can implement a trait along the lines of

impl Write for &'_ Self { ... }

and some already do:

impl<'a> Write for &'a UnixStream { ... }
impl<'_> Write for &'_ TcpStream { ... }
impl<'_> Write for &'_ File { ... }

However, these appear to be the extent of the current implementations. The following types could also do the same:

  • Sink – does not inspect data and Write methods are a no-op;
  • Stdin/Stdout – internally a Mutex (and even if the Mutex was removed in the future, the underlying syscalls are MT-safe – much like they are for a regular File);
  • ChildStdin – similar to File or *Streams;

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-feature-requestCategory: 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.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions