pub struct IOCompletionPort { /* private fields */ }Expand description
This module provides a safe and idiomatic Rust interface over the IOCompletionPort handle and associated Windows API functions. This struct represents an I/O completion port, which is an object used in asynchronous I/O operations on Windows.
Implementations§
Source§impl IOCompletionPort
impl IOCompletionPort
Sourcepub fn new(
file_handle: &FileHandle,
existing_completion_port: Option<&IOCompletionPort>,
completion_key: ULONG_PTR,
number_of_concurrent_threads: DWORD,
) -> Result<Self>
pub fn new( file_handle: &FileHandle, existing_completion_port: Option<&IOCompletionPort>, completion_key: ULONG_PTR, number_of_concurrent_threads: DWORD, ) -> Result<Self>
Create a new IOCompletionPort. This function wraps the Windows CreateIoCompletionPort function, providing error handling and automatic resource management.
§Arguments
file_handle- A reference to a FileHandle to associate with the IOCompletionPort.existing_completion_port- An optional reference to an existing IOCompletionPort. If provided, the new IOCompletionPort will be associated with it.completion_key- The completion key associated with the file handle.number_of_concurrent_threads- The maximum number of threads that the operating system can allow to concurrently process I/O completion packets for the I/O completion port.
§Return
Returns a Result with the new IOCompletionPort if successful, or an io::Error if the function fails.
pub fn mutex_guarded_handle(&self) -> Result<MutexGuard<'_, HANDLE>>
Trait Implementations§
Source§impl Default for IOCompletionPort
impl Default for IOCompletionPort
Source§impl Drop for IOCompletionPort
impl Drop for IOCompletionPort
Source§fn drop(&mut self)
fn drop(&mut self)
Drop method for IOCompletionPort. This wraps the Windows CloseHandle function, providing automatic resource cleanup when the IOCompletionPort is dropped. If an error occurs while dropping, it is logged and the drop continues. This is because panicking in Drop can cause unwinding issues.