Struct mio::windows::Binding
[−]
[src]
pub struct Binding { /* fields omitted */ }
A Binding
is embedded in all I/O objects associated with a Poll
object.
Each registration keeps track of which selector the I/O object is
associated with, ensuring that implementations of Evented
can be
conformant for the various methods on Windows.
If you're working with custom IOCP-enabled objects then you'll want to
ensure that one of these instances is stored in your object and used in the
implementation of Evented
.
For more information about how to use this see the windows
module
documentation in this crate.
Methods
impl Binding
[src]
fn new() -> Binding
Creates a new blank binding ready to be inserted into an I/O object.
Won't actually do anything until associated with a Poll
loop.
unsafe fn register_handle(
&self,
handle: &AsRawHandle,
token: Token,
poll: &Poll
) -> Result<()>
&self,
handle: &AsRawHandle,
token: Token,
poll: &Poll
) -> Result<()>
Registers a new handle with the Poll
specified, also assigning the
token
specified.
This function is intended to be used as part of Evented::register
for
custom IOCP objects. It will add the specified handle to the internal
IOCP object with the provided token
. All future events generated by
the handled provided will be received by the Poll
's internal IOCP
object.
Unsafety
This function is unsafe as the Poll
instance has assumptions about
what the OVERLAPPED
pointer used for each I/O operation looks like.
Specifically they must all be instances of the Overlapped
type in
this crate. More information about this can be found on the
windows
module in this crate.
unsafe fn register_socket(
&self,
handle: &AsRawSocket,
token: Token,
poll: &Poll
) -> Result<()>
&self,
handle: &AsRawSocket,
token: Token,
poll: &Poll
) -> Result<()>
Same as register_handle
but for sockets.
unsafe fn reregister_handle(
&self,
_handle: &AsRawHandle,
_token: Token,
poll: &Poll
) -> Result<()>
&self,
_handle: &AsRawHandle,
_token: Token,
poll: &Poll
) -> Result<()>
Reregisters the handle provided from the Poll
provided.
This is intended to be used as part of Evented::reregister
but note
that this function does not currently reregister the provided handle
with the poll
specified. IOCP has a special binding for changing the
token which has not yet been implemented. Instead this function should
be used to assert that the call to reregister
happened on the same
Poll
that was passed into to register
.
Eventually, though, the provided handle
will be re-assigned to have
the token token
on the given poll
assuming that it's been
previously registered with it.
Unsafety
This function is unsafe for similar reasons to register
. That is,
there may be pending I/O events and such which aren't handled correctly.
unsafe fn reregister_socket(
&self,
_socket: &AsRawSocket,
_token: Token,
poll: &Poll
) -> Result<()>
&self,
_socket: &AsRawSocket,
_token: Token,
poll: &Poll
) -> Result<()>
Same as reregister_handle
, but for sockets.
unsafe fn deregister_handle(
&self,
_handle: &AsRawHandle,
poll: &Poll
) -> Result<()>
&self,
_handle: &AsRawHandle,
poll: &Poll
) -> Result<()>
Deregisters the handle provided from the Poll
provided.
This is intended to be used as part of Evented::deregister
but note
that this function does not currently deregister the provided handle
from the poll
specified. IOCP has a special binding for that which has
not yet been implemented. Instead this function should be used to assert
that the call to deregister
happened on the same Poll
that was
passed into to register
.
Unsafety
This function is unsafe for similar reasons to register
. That is,
there may be pending I/O events and such which aren't handled correctly.
unsafe fn deregister_socket(
&self,
_socket: &AsRawSocket,
poll: &Poll
) -> Result<()>
&self,
_socket: &AsRawSocket,
poll: &Poll
) -> Result<()>
Same as deregister_handle
, but for sockets.