pub trait TcpListenerExt {
// Required method
fn cap_bind<A>(agent: &mut CapNetAgent, addrs: A) -> Result<TcpListener>
where A: ToSocketAddrs;
}Expand description
Adds extra features to std::net::TcpListener that require Casper.
Required Methods§
Sourcefn cap_bind<A>(agent: &mut CapNetAgent, addrs: A) -> Result<TcpListener>where
A: ToSocketAddrs,
fn cap_bind<A>(agent: &mut CapNetAgent, addrs: A) -> Result<TcpListener>where
A: ToSocketAddrs,
Create a new TcpListener bound to the specified address.
§Examples
use std::{io, str::FromStr, net::TcpListener };
use capsicum::casper::Casper;
use capsicum_net::{CasperExt, std::TcpListenerExt};
// Safe because we are single-threaded
let mut casper = unsafe { Casper::new().unwrap() };
let mut cap_net = casper.net().unwrap();
let socket = TcpListener::cap_bind(&mut cap_net, "127.0.0.1:8084")
.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.