pub struct LocalSocketListener { /* private fields */ }👎Deprecated: does not integrate with async runtimes, leading to poor performance and bugs related to reading and writing at the same time (you can’t) – see the
tokio modules for relevant IPC primitives or open an issue if you want more async runtimes to be supported as wellAvailable on crate feature
nonblocking only.Expand description
An asynchronous local socket server, listening for connections.
Implementations§
Source§impl LocalSocketListener
impl LocalSocketListener
Sourcepub async fn bind<'a>(
name: impl ToLocalSocketName<'_> + Send + 'static,
) -> Result<Self>
👎Deprecated: does not integrate with async runtimes, leading to poor performance and bugs related to reading and writing at the same time (you can’t) – see the tokio modules for relevant IPC primitives or open an issue if you want more async runtimes to be supported as well
pub async fn bind<'a>( name: impl ToLocalSocketName<'_> + Send + 'static, ) -> Result<Self>
tokio modules for relevant IPC primitives or open an issue if you want more async runtimes to be supported as wellCreates a socket server with the specified local socket name.
Sourcepub async fn accept(&self) -> Result<LocalSocketStream>
👎Deprecated: does not integrate with async runtimes, leading to poor performance and bugs related to reading and writing at the same time (you can’t) – see the tokio modules for relevant IPC primitives or open an issue if you want more async runtimes to be supported as well
pub async fn accept(&self) -> Result<LocalSocketStream>
tokio modules for relevant IPC primitives or open an issue if you want more async runtimes to be supported as wellListens for incoming connections to the socket, blocking until a client is connected.
See incoming for a convenient way to create a main loop for a server.
Sourcepub fn incoming(&self) -> Incoming
👎Deprecated: does not integrate with async runtimes, leading to poor performance and bugs related to reading and writing at the same time (you can’t) – see the tokio modules for relevant IPC primitives or open an issue if you want more async runtimes to be supported as well
pub fn incoming(&self) -> Incoming
tokio modules for relevant IPC primitives or open an issue if you want more async runtimes to be supported as wellCreates an infinite asynchronous stream which calls accept() with each iteration. Used together with for_each/try_for_each stream adaptors to conveniently create a main loop for a socket server.
§Example
See struct-level documentation for a complete example which already uses this method.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for LocalSocketListener
impl RefUnwindSafe for LocalSocketListener
impl Send for LocalSocketListener
impl Sync for LocalSocketListener
impl Unpin for LocalSocketListener
impl UnwindSafe for LocalSocketListener
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