pub trait UnixListenerExt {
// Required method
fn cap_bind<P>(agent: &mut CapNetAgent, path: P) -> Result<UnixListener>
where P: AsRef<Path>;
}Expand description
Adds extra features to std::os::unix::net::UnixListener that require
Casper.
Required Methods§
Sourcefn cap_bind<P>(agent: &mut CapNetAgent, path: P) -> Result<UnixListener>
fn cap_bind<P>(agent: &mut CapNetAgent, path: P) -> Result<UnixListener>
Bind a std::net::UdpSocket to a port.
§Examples
use std::{io, str::FromStr, os::unix::net::UnixListener };
use capsicum::casper::Casper;
use capsicum_net::{CasperExt, std::UnixListenerExt};
// Safe because we are single-threaded
let mut casper = unsafe { Casper::new().unwrap() };
let mut cap_net = casper.net().unwrap();
let path = "/var/run/foo.sock";
let socket = UnixListener::cap_bind(&mut cap_net, &path).unwrap();Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.