pub struct KeepAlive(/* private fields */);
Expand description
Socket option to send keep-alives.
Implements the SOL_SOKCET/SO_KEEPALIVE socket option.
§Examples
Setting the option:
use asyncio::*;
use asyncio::ip::*;
use asyncio::socket_base::KeepAlive;
let ctx = &IoContext::new().unwrap();
let soc = TcpSocket::new(ctx, Tcp::v4()).unwrap();
soc.set_option(KeepAlive::new(true)).unwrap();
Getting the option:
use asyncio::*;
use asyncio::ip::*;
use asyncio::socket_base::KeepAlive;
let ctx = &IoContext::new().unwrap();
let soc = TcpSocket::new(ctx, Tcp::v4()).unwrap();
let opt: KeepAlive = soc.get_option().unwrap();
let is_set: bool = opt.get();
Implementations§
Trait Implementations§
Source§impl<P: Protocol> GetSocketOption<P> for KeepAlive
impl<P: Protocol> GetSocketOption<P> for KeepAlive
Source§impl<P: Protocol> SetSocketOption<P> for KeepAlive
impl<P: Protocol> SetSocketOption<P> for KeepAlive
Auto Trait Implementations§
impl Freeze for KeepAlive
impl RefUnwindSafe for KeepAlive
impl Send for KeepAlive
impl Sync for KeepAlive
impl Unpin for KeepAlive
impl UnwindSafe for KeepAlive
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