pub struct ReuseAddr(/* private fields */);
Expand description
Socket option to allow the socket to be bound to an address that is already in use.
Implements the SOL_SOCKET/SO_REUSEADDR socket option.
§Examples
Setting the option:
use asyncio::*;
use asyncio::ip::*;
use asyncio::socket_base::ReuseAddr;
let ctx = &IoContext::new().unwrap();
let soc = TcpListener::new(ctx, Tcp::v4()).unwrap();
soc.set_option(ReuseAddr::new(true)).unwrap();
Getting the option:
use asyncio::*;
use asyncio::ip::*;
use asyncio::socket_base::ReuseAddr;
let ctx = &IoContext::new().unwrap();
let soc = TcpListener::new(ctx, Tcp::v4()).unwrap();
let opt: ReuseAddr = soc.get_option().unwrap();
let is_set: bool = opt.get();
Implementations§
Trait Implementations§
Source§impl<P: Protocol> GetSocketOption<P> for ReuseAddr
impl<P: Protocol> GetSocketOption<P> for ReuseAddr
Source§impl<P: Protocol> SetSocketOption<P> for ReuseAddr
impl<P: Protocol> SetSocketOption<P> for ReuseAddr
Auto Trait Implementations§
impl Freeze for ReuseAddr
impl RefUnwindSafe for ReuseAddr
impl Send for ReuseAddr
impl Sync for ReuseAddr
impl Unpin for ReuseAddr
impl UnwindSafe for ReuseAddr
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more