accept

Function accept 

Source
pub fn accept(fd: RawFd) -> OperationProgress<Accept> 
Expand description

Accepts a connection on a listening socket.

§Detach safe

This method is not detach safe, which means that resources will leak if not handled carefully.

§Returns

This function returns OperationProgress<Accept>. This function signature is equivalent to:

async fn accept(RawFd) -> std::io::Result<(RawFd, SocketAddr)>

§Behavior

As soon as this function is called, the operation is submitted into the io-driver used by the current platform (for example io-uring). If the user then chooses to drop OperationProgress before the Future is ready, the operation will NOT tried be cancelled, but instead “detached”.

See more what methods are available to the return type.

§Examples

use std::mem::MaybeUninit;

async fn accept_example() -> std::io::Result<()> {

    let (client_fd, addr) = lio::accept(fd).await?;
    println!("Accepted connection on fd: {}", client_fd);
    Ok(())
}