pub trait DatagramBasedExt: 'static {
    // Required method
    fn condition_check(&self, condition: IOCondition) -> IOCondition;
}
Expand description

Trait containing all DatagramBased methods.

Implementors

DatagramBased, Socket

Required Methods§

source

fn condition_check(&self, condition: IOCondition) -> IOCondition

Checks on the readiness of self to perform operations. The operations specified in condition are checked for and masked against the currently-satisfied conditions on self. The result is returned.

glib::IOCondition::IN will be set in the return value if data is available to read with DatagramBasedExtManual::receive_messages(), or if the connection is closed remotely (EOS); and if the datagram_based has not been closed locally using some implementation-specific method (such as SocketExt::close() or SocketExt::shutdown() with shutdown_read set, if it’s a Socket).

If the connection is shut down or closed (by calling SocketExt::close() or SocketExt::shutdown() with shutdown_read set, if it’s a Socket, for example), all calls to this function will return IOErrorEnum::Closed.

glib::IOCondition::OUT will be set if it is expected that at least one byte can be sent using DatagramBasedExtManual::send_messages() without blocking. It will not be set if the datagram_based has been closed locally.

glib::IOCondition::HUP will be set if the connection has been closed locally.

glib::IOCondition::ERR will be set if there was an asynchronous error in transmitting data previously enqueued using DatagramBasedExtManual::send_messages().

Note that on Windows, it is possible for an operation to return IOErrorEnum::WouldBlock even immediately after condition_check() has claimed that the DatagramBased is ready for writing. Rather than calling condition_check() and then writing to the DatagramBased if it succeeds, it is generally better to simply try writing right away, and try again later if the initial attempt returns IOErrorEnum::WouldBlock.

It is meaningless to specify glib::IOCondition::ERR or glib::IOCondition::HUP in condition; these conditions will always be set in the output if they are true. Apart from these flags, the output is guaranteed to be masked by condition.

This call never blocks.

condition

a glib::IOCondition mask to check

Returns

the glib::IOCondition mask of the current state

Implementors§