pub struct ListeningServer(/* private fields */);Expand description
A server listeing on a socket
Implementations§
Source§impl ListeningServer
impl ListeningServer
Sourcepub fn socket(&self) -> SocketAddr
pub fn socket(&self) -> SocketAddr
Gets the SocketAddr which the server is currently listening on.
Sourcepub fn detach(self)
pub fn detach(self)
Detaches the server thread.
This doesn’t actually kill the server, it just stops the current thread from
blocking due to the server running. In the case where main returns due to
this unblocking, then the server will be killed due to process death.
The required use of this is when writing unit tests which spawn servers and do not want to block the test-runner by waiting on the server to stop because it probably never will.
See this hyper issue for more information.
Auto Trait Implementations§
impl !RefUnwindSafe for ListeningServer
impl !UnwindSafe for ListeningServer
impl Freeze for ListeningServer
impl Send for ListeningServer
impl Sync for ListeningServer
impl Unpin for ListeningServer
impl UnsafeUnpin for ListeningServer
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