pub struct Linger(/* private fields */);
Expand description
Socket option to specify whether the socket lingers on close if unsent data is present.
Implements the SOL_SOCKET/SO_LINGER socket option.
§Examples
Setting the option:
use asyncio::*;
use asyncio::ip::*;
use asyncio::socket_base::Linger;
let ctx = &IoContext::new().unwrap();
let soc = TcpSocket::new(ctx, Tcp::v4()).unwrap();
soc.set_option(Linger::new(Some(30))).unwrap();
Getting the option:
use asyncio::*;
use asyncio::ip::*;
use asyncio::socket_base::Linger;
let ctx = &IoContext::new().unwrap();
let soc = TcpSocket::new(ctx, Tcp::v4()).unwrap();
let opt: Linger = soc.get_option().unwrap();
let is_set: Option<u16> = opt.get();
Implementations§
Trait Implementations§
Source§impl<P: Protocol> GetSocketOption<P> for Linger
impl<P: Protocol> GetSocketOption<P> for Linger
Source§impl<P: Protocol> SetSocketOption<P> for Linger
impl<P: Protocol> SetSocketOption<P> for Linger
Auto Trait Implementations§
impl Freeze for Linger
impl RefUnwindSafe for Linger
impl Send for Linger
impl Sync for Linger
impl Unpin for Linger
impl UnwindSafe for Linger
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