Skip to main content

base_scheduler/
socket_set_option.rs

1// Released under the MIT License.
2// Copyright, 2026, by Samuel Williams.
3
4use super::SocketOperation;
5use crate::{Cancellation, OperationResult, SocketOption};
6use std::future::Future;
7
8/// Set a typed socket option. See [`SocketOptions`](crate::SocketOptions) for the shared option contract; the opposite operation is not required.
9pub trait SocketSetOption<O: SocketOption>: SocketOperation {
10    /// Set the option and wait for syscall completion. This borrows the descriptor and does not change its ownership.
11    fn socket_set_option(
12        &self,
13        socket: &Self::Socket,
14        option: O,
15        value: O::Value,
16        cancellation: &Cancellation,
17    ) -> impl Future<Output = OperationResult<()>> + Send;
18}