pub struct CancellableTcpListener {
inner: TcpListener,
is_canceled: AtomicBool,
}
Expand description
Like std::net::tcp::TcpListener
, but cancel
lable.
Fields§
§inner: TcpListener
§is_canceled: AtomicBool
An atomic boolean flag that indicates if the listener is cancel
led.
NOTE: This can be safely read/written by multiple thread at the same time (note that its
methods take &self
instead of &mut self
). To set the flag, use store
method with
Ordering::Release
. To read the flag, use load
method with Ordering::Acquire
. We will
discuss their precise semantics later.
Implementations§
Source§impl CancellableTcpListener
impl CancellableTcpListener
Sourcepub fn bind<A: ToSocketAddrs>(addr: A) -> Result<CancellableTcpListener>
pub fn bind<A: ToSocketAddrs>(addr: A) -> Result<CancellableTcpListener>
Wraps TcpListener::bind
.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for CancellableTcpListener
impl RefUnwindSafe for CancellableTcpListener
impl Send for CancellableTcpListener
impl Sync for CancellableTcpListener
impl Unpin for CancellableTcpListener
impl UnwindSafe for CancellableTcpListener
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