pub trait ShutdownConnection {
// Required method
fn poll_shutdown(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>;
}Required Methods§
Sourcefn poll_shutdown(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>
fn poll_shutdown(&mut self, cx: &mut Context<'_>) -> Poll<Result<()>>
Initiates or attempts to shut down this writer, returning success when the I/O connection has completely shut down.
§Return value
This function returns a Poll<io::Result<()>> classified as such:
-
Poll::Ready(Ok(()))- indicates that the connection was successfully shut down and is now safe to deallocate/drop/close resources associated with it. This method means that the current task will no longer receive any notifications due to this method and the I/O object itself is likely no longer usable. -
Poll::Pending- indicates that shutdown is initiated but could not complete just yet. This may mean that more I/O needs to happen to continue this shutdown operation. The current task is scheduled to receive a notification when it’s otherwise ready to continue the shutdown operation. When woken up this method should be called again. -
Poll::Ready(Err(e))- indicates a fatal error has happened with shutdown, indicating that the shutdown operation did not complete successfully. This typically means that the I/O object is no longer usable.
§Errors
This function can return normal I/O errors through Err, described
above. Additionally this method may also render the underlying
Write::write method no longer usable (e.g. will return errors in the
future). It’s recommended that once shutdown is called the
write method is no longer called.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".