Skip to main content

SocketShutdown

Trait SocketShutdown 

Source
pub trait SocketShutdown: SocketOperation {
    // Required methods
    fn socket_shutdown(
        &self,
        socket: &Self::Socket,
        how: Shutdown,
    ) -> impl Future<Output = Result<()>> + Send;
    fn socket_shutdown_submit(
        &self,
        socket: &Self::Socket,
        how: Shutdown,
    ) -> impl Future<Output = Result<()>> + Send;
}
Expand description

Shut down one or both directions of a socket through the scheduler.

Required Methods§

Source

fn socket_shutdown( &self, socket: &Self::Socket, how: Shutdown, ) -> impl Future<Output = Result<()>> + Send

Shut down reads, writes, or both, awaiting bounded admission and OS completion. The descriptor remains owned by the caller. Finish preceding writes before Shutdown::Write; reads may continue. Success confirms local shutdown, not peer receipt. Repeated shutdown and later I/O preserve platform-specific results.

This lazy cleanup operation has no cancellation input. After admission it retains the socket and executes even if its waiter is dropped. Await its completion before explicitly closing the socket.

Source

fn socket_shutdown_submit( &self, socket: &Self::Socket, how: Shutdown, ) -> impl Future<Output = Result<()>> + Send

Request shutdown and await bounded admission only. Acceptance does not establish completion or ordering with later operations, including close. The backend retains the socket until execution finishes; graceful scheduler shutdown drains accepted requests. Use socket_shutdown when subsequent work requires completion or errors.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§