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