std/os/net/linux_ext/
socket.rs1use crate::io;
4use crate::os::unix::net;
5use crate::sys::AsInner;
6
7#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
13pub impl(self) trait UnixSocketExt {
14 #[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
16 fn passcred(&self) -> io::Result<bool>;
17
18 #[cfg_attr(
28 any(target_os = "linux", target_os = "android", target_os = "cygwin"),
29 doc = "```no_run"
30 )]
31 #[cfg_attr(
32 not(any(target_os = "linux", target_os = "android", target_os = "cygwin")),
33 doc = "```ignore (needs linux)"
34 )]
35 #[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
49 fn set_passcred(&self, passcred: bool) -> io::Result<()>;
50}
51
52#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
53impl UnixSocketExt for net::UnixDatagram {
54 fn passcred(&self) -> io::Result<bool> {
55 self.as_inner().passcred()
56 }
57
58 fn set_passcred(&self, passcred: bool) -> io::Result<()> {
59 self.as_inner().set_passcred(passcred)
60 }
61}
62
63#[unstable(feature = "unix_socket_ancillary_data", issue = "76915")]
64impl UnixSocketExt for net::UnixStream {
65 fn passcred(&self) -> io::Result<bool> {
66 self.as_inner().passcred()
67 }
68
69 fn set_passcred(&self, passcred: bool) -> io::Result<()> {
70 self.as_inner().set_passcred(passcred)
71 }
72}