Skip to main content

base_scheduler/
socket_connect.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/// Connect an existing socket to a peer IP address.
9pub trait SocketConnect: SocketOperation {
10    /// Connect an existing socket, preserving any prior local binding or configuration. A cancelled connect can still complete in the kernel; it does not make the descriptor reusable for another connection attempt.
11    fn socket_connect(
12        &self,
13        socket: &Self::Socket,
14        address: SocketAddress,
15        cancellation: &Cancellation,
16    ) -> impl Future<Output = OperationResult<()>> + Send;
17}