base_scheduler/socket_close.rs
1// Released under the MIT License.
2// Copyright, 2026, by Samuel Williams.
3
4use super::SocketOperation;
5use std::{future::Future, io};
6
7/// Consume and close an exclusively owned socket through the scheduler.
8pub trait SocketClose: SocketOperation {
9 /// Consume and close an exclusively owned socket, awaiting bounded admission and OS completion. Finish all other operations first: close never cancels or joins them, and retained backend use may panic. Dropping an unpolled close releases the owned descriptor through its ordinary destructor.
10 fn socket_close(&self, socket: Self::Socket) -> impl Future<Output = io::Result<()>> + Send;
11
12 /// Consume the socket and await bounded cleanup admission only. Accepted close jobs survive waiter abandonment and are drained during graceful scheduler shutdown. Execution errors are discarded; use `socket_close` to observe them. The same exclusive-ownership requirement applies.
13 fn socket_close_submit(
14 &self,
15 socket: Self::Socket,
16 ) -> impl Future<Output = io::Result<()>> + Send;
17}