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;
The implementations of
Writewhich are MT-safe under the covers can implement a trait along the lines ofand some already do:
However, these appear to be the extent of the current implementations. The following types could also do the same:
Sink– does not inspect data andWritemethods are a no-op;Stdin/Stdout– internally aMutex(and even if theMutexwas removed in the future, the underlying syscalls are MT-safe – much like they are for a regularFile);ChildStdin– similar toFileor*Streams;