Skip to main content

base_scheduler/
socket_bind.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/// Bind an existing socket to a local IP address.
9pub trait SocketBind: SocketOperation {
10    /// Bind an existing socket to a local address. Port zero requests an OS-selected port, available through `socket_local_address`.
11    fn socket_bind(
12        &self,
13        socket: &Self::Socket,
14        address: SocketAddress,
15        cancellation: &Cancellation,
16    ) -> impl Future<Output = OperationResult<()>> + Send;
17}