pub trait DatagramBasedExt: IsA<DatagramBased> + Sealed + 'static {
    // Provided method
    fn condition_check(&self, condition: IOCondition) -> IOCondition { ... }
Expand description

Trait containing all DatagramBased methods.


DatagramBased, Socket

Provided Methods§


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 g_datagram_based_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 g_socket_close() or g_socket_shutdown() with @shutdown_read set, if it’s a #GSocket).

If the connection is shut down or closed (by calling g_socket_close() or g_socket_shutdown() with @shutdown_read set, if it’s a #GSocket, 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 g_datagram_based_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 g_datagram_based_send_messages().

Note that on Windows, it is possible for an operation to return IOErrorEnum::WouldBlock even immediately after g_datagram_based_condition_check() has claimed that the #GDatagramBased is ready for writing. Rather than calling g_datagram_based_condition_check() and then writing to the #GDatagramBased 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.


a #GIOCondition mask to check


the #GIOCondition mask of the current state

Object Safety§

This trait is not object safe.