UnixSocketExt in std::os::linux::net - Rust (original) (raw)
Trait UnixSocketExt
pub trait UnixSocketExt: Sealed {
// Required methods
fn passcred(&self) -> Result<bool>;
fn set_passcred(&self, passcred: bool) -> Result<()>;
}
🔬This is a nightly-only experimental API. (unix_socket_ancillary_data
#76915)
Available on Linux and (Linux or Android) only.
Expand description
🔬This is a nightly-only experimental API. (unix_socket_ancillary_data
#76915)
Query the current setting of socket option SO_PASSCRED
.
🔬This is a nightly-only experimental API. (unix_socket_ancillary_data
#76915)
Enable or disable socket option SO_PASSCRED
.
This option enables the credentials of the sending process to be received as a control message in AncillaryData.
§Examples
#![feature(unix_socket_ancillary_data)]
use std::os::linux:🥅:UnixSocketExt;
use std::os::unix:🥅:UnixDatagram;
fn main() -> std::io::Result<()> {
let sock = UnixDatagram::unbound()?;
sock.set_passcred(true).expect("set_passcred failed");
Ok(())
}