try_clone/
std.rs

1use std::{
2    fs::File,
3    io::{self, PipeReader, PipeWriter},
4    net::{TcpListener, TcpStream, UdpSocket},
5};
6
7#[cfg(feature = "blanket-impl")]
8use crate::ForwardTryCloneToClone;
9use crate::TryClone;
10
11#[cfg(feature = "blanket-impl")]
12impl !ForwardTryCloneToClone for File {}
13impl TryClone for File {
14    type Error = io::Error;
15
16    fn try_clone(&self) -> Result<Self, Self::Error> {
17        File::try_clone(self)
18    }
19}
20
21#[cfg(feature = "blanket-impl")]
22impl !ForwardTryCloneToClone for PipeReader {}
23impl TryClone for PipeReader {
24    type Error = io::Error;
25
26    fn try_clone(&self) -> Result<Self, Self::Error> {
27        PipeReader::try_clone(self)
28    }
29}
30
31#[cfg(feature = "blanket-impl")]
32impl !ForwardTryCloneToClone for PipeWriter {}
33impl TryClone for PipeWriter {
34    type Error = io::Error;
35
36    fn try_clone(&self) -> Result<Self, Self::Error> {
37        PipeWriter::try_clone(self)
38    }
39}
40
41#[cfg(feature = "blanket-impl")]
42impl !ForwardTryCloneToClone for TcpStream {}
43impl TryClone for TcpStream {
44    type Error = io::Error;
45
46    fn try_clone(&self) -> Result<Self, Self::Error> {
47        TcpStream::try_clone(self)
48    }
49}
50
51#[cfg(feature = "blanket-impl")]
52impl !ForwardTryCloneToClone for TcpListener {}
53impl TryClone for TcpListener {
54    type Error = io::Error;
55
56    fn try_clone(&self) -> Result<Self, Self::Error> {
57        TcpListener::try_clone(self)
58    }
59}
60
61#[cfg(feature = "blanket-impl")]
62impl !ForwardTryCloneToClone for UdpSocket {}
63impl TryClone for UdpSocket {
64    type Error = io::Error;
65
66    fn try_clone(&self) -> Result<Self, Self::Error> {
67        UdpSocket::try_clone(self)
68    }
69}