This PR replaces the SocketEvent struct with a macro call to the (existing) bitflags crate. Additionally, monitor's event argument now takes a SocketEvent rather than the previous raw integer.
Notably, I removed the SocketEvent::ALL option in favor of SocketEvent::all(), due to two reasons: removing the bitflags all function is not possible and by using the all function, all rust-defined events are passed only, rather than 0xFFFF. The original behaviour is still possible by using: SocketEvent::from_bits_unchecked(0xFFFF).
An example of the change in this PR (with type annotation), before:
let events: u32 = SocketEvent::CONNECTED.to_raw()
| SocketEvent::CONNECT_DELAYED.to_raw()
| SocketEvent::CONNECT_RETRIED.to_raw()
| SocketEvent::DISCONNECTED.to_raw();
socket.monitor(&endpoint, events as i32)?;
This PR replaces the
SocketEvent
struct with a macro call to the (existing)bitflags
crate. Additionally,monitor
's event argument now takes aSocketEvent
rather than the previous raw integer.The docstrings come from the docs and the header file.
Notably, I removed the
SocketEvent::ALL
option in favor ofSocketEvent::all()
, due to two reasons: removing the bitflagsall
function is not possible and by using theall
function, all rust-defined events are passed only, rather than0xFFFF
. The original behaviour is still possible by using:SocketEvent::from_bits_unchecked(0xFFFF)
.An example of the change in this PR (with type annotation), before:
After: