Struct miow::iocp::CompletionPort [−][src]
pub struct CompletionPort { /* fields omitted */ }
A handle to an Windows I/O Completion Port.
Methods
impl CompletionPort
[src]
impl CompletionPort
pub fn new(threads: u32) -> Result<CompletionPort>
[src]
pub fn new(threads: u32) -> Result<CompletionPort>
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]
pub fn add_handle<T: AsRawHandle + ?Sized>(
&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]
pub fn add_socket<T: AsRawSocket + ?Sized>(
&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]
pub fn get(&self, timeout: Option<Duration>) -> Result<CompletionStatus>
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]
pub fn get_many<'a>(
&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]
pub fn post(&self, status: CompletionStatus) -> Result<()>
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 Debug for CompletionPort
[src]
impl Debug for CompletionPort
fn fmt(&self, f: &mut Formatter) -> Result
[src]
fn fmt(&self, f: &mut Formatter) -> Result
Formats the value using the given formatter. Read more
impl AsRawHandle for CompletionPort
[src]
impl AsRawHandle for CompletionPort
fn as_raw_handle(&self) -> HANDLE
[src]
fn as_raw_handle(&self) -> HANDLE
Extracts the raw handle, without taking any ownership.
impl FromRawHandle for CompletionPort
[src]
impl FromRawHandle for CompletionPort
unsafe fn from_raw_handle(handle: HANDLE) -> CompletionPort
[src]
unsafe fn from_raw_handle(handle: HANDLE) -> CompletionPort
Constructs a new I/O object from the specified raw handle. Read more
impl IntoRawHandle for CompletionPort
[src]
impl IntoRawHandle for CompletionPort
fn into_raw_handle(self) -> HANDLE
[src]
fn into_raw_handle(self) -> HANDLE
Consumes this object, returning the raw underlying handle. Read more
Auto Trait Implementations
impl Send for CompletionPort
impl Send for CompletionPort
impl Sync for CompletionPort
impl Sync for CompletionPort