Struct miow::iocp::CompletionPort [−][src]
A handle to an Windows I/O Completion Port.
Implementations
impl CompletionPort
[src]
pub fn new(threads: u32) -> Result<CompletionPort>
[src]
Creates a new I/O completion port with the specified concurrency value.
The number of threads given corresponds to the level of concurrency allowed for threads associated with this port. Consult the Windows documentation for more information about this value.
pub fn add_handle<T: AsRawHandle + ?Sized>(
&self,
token: usize,
t: &T
) -> Result<()>
[src]
&self,
token: usize,
t: &T
) -> Result<()>
Associates a new HANDLE
to this I/O completion port.
This function will associate the given handle to this port with the
given token
to be returned in status messages whenever it receives a
notification.
Any object which is convertible to a HANDLE
via the AsRawHandle
trait can be provided to this function, such as std::fs::File
and
friends.
pub fn add_socket<T: AsRawSocket + ?Sized>(
&self,
token: usize,
t: &T
) -> Result<()>
[src]
&self,
token: usize,
t: &T
) -> Result<()>
Associates a new SOCKET
to this I/O completion port.
This function will associate the given socket to this port with the
given token
to be returned in status messages whenever it receives a
notification.
Any object which is convertible to a SOCKET
via the AsRawSocket
trait can be provided to this function, such as std::net::TcpStream
and friends.
pub fn get(&self, timeout: Option<Duration>) -> Result<CompletionStatus>
[src]
Dequeue a completion status from this I/O completion port.
This function will associate the calling thread with this completion port and then wait for a status message to become available. The precise semantics on when this function returns depends on the concurrency value specified when the port was created.
A timeout can optionally be specified to this function. If None
is
provided this function will not time out, and otherwise it will time out
after the specified duration has passed.
On success this will return the status message which was dequeued from this completion port.
pub fn get_many<'a>(
&self,
list: &'a mut [CompletionStatus],
timeout: Option<Duration>
) -> Result<&'a mut [CompletionStatus]>
[src]
&self,
list: &'a mut [CompletionStatus],
timeout: Option<Duration>
) -> Result<&'a mut [CompletionStatus]>
Dequeues a number of completion statuses from this I/O completion port.
This function is the same as get
except that it may return more than
one status. A buffer of “zero” statuses is provided (the contents are
not read) and then on success this function will return a sub-slice of
statuses which represent those which were dequeued from this port. This
function does not wait to fill up the entire list of statuses provided.
Like with get
, a timeout may be specified for this operation.
pub fn post(&self, status: CompletionStatus) -> Result<()>
[src]
Posts a new completion status onto this I/O completion port.
This function will post the given status, with custom parameters, to the
port. Threads blocked in get
or get_many
will eventually receive
this status.
Trait Implementations
impl AsRawHandle for CompletionPort
[src]
fn as_raw_handle(&self) -> HANDLE
[src]
impl Debug for CompletionPort
[src]
impl FromRawHandle for CompletionPort
[src]
unsafe fn from_raw_handle(handle: HANDLE) -> CompletionPort
[src]
impl IntoRawHandle for CompletionPort
[src]
fn into_raw_handle(self) -> HANDLE
[src]
Auto Trait Implementations
impl RefUnwindSafe for CompletionPort
impl Send for CompletionPort
impl Sync for CompletionPort
impl Unpin for CompletionPort
impl UnwindSafe for CompletionPort
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,