Skip to main content

base_scheduler/
socket_accept.rs

1// Released under the MIT License.
2// Copyright, 2026, by Samuel Williams.
3
4use super::SocketOperation;
5use crate::{Cancellation, OperationResult, SocketAddress};
6use std::future::Future;
7
8/// Accept one connection from a listening socket.
9pub trait SocketAccept: SocketOperation {
10    /// Accept one connection from a listening socket, returning an owned nonblocking socket and its peer address.
11    fn socket_accept(
12        &self,
13        socket: &Self::Socket,
14        cancellation: &Cancellation,
15    ) -> impl Future<Output = OperationResult<(Self::Socket, SocketAddress)>> + Send;
16}