Skip to main content

EventHandler

Trait EventHandler 

Source
pub unsafe trait EventHandler {
    const WL_INTERFACE: &'static wl_interface;

    // Required method
    unsafe fn handle_event(
        &self,
        queue: &Queue,
        data: *mut u8,
        slf: &UntypedBorrowedProxy,
        opcode: u32,
        args: *mut wl_argument,
    );

    // Provided method
    fn mutable_type() -> Option<(TypeId, &'static str)> { ... }
}
Expand description

An event handler that can handle raw libwayland events.

§Safety

  • WL_INTERFACE must be a valid wl_interface.
  • mutable_type must always return the same value.

Required Associated Constants§

Source

const WL_INTERFACE: &'static wl_interface

The type of interface that can be handled by this event handler.

Required Methods§

Source

unsafe fn handle_event( &self, queue: &Queue, data: *mut u8, slf: &UntypedBorrowedProxy, opcode: u32, args: *mut wl_argument, )

Dispatches a raw libwayland event.

§Safety
  • slf must have an interface compatible with WL_INTERFACE.
  • opcode and args must conform to an event of WL_INTERFACE.
  • Any objects contained in args must remain valid for the duration of the call.
  • If Self::mutable_data returns Some, then data must be &mut T where T has the type ID returned by mutable_data.

Provided Methods§

Source

fn mutable_type() -> Option<(TypeId, &'static str)>

Returns the mutable data type required by this event handler.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§