Skip to main content

Payload

Trait Payload 

Source
pub unsafe trait Payload: Sized + 'static {
    // Required method
    unsafe fn read(raw: *const c_void) -> Option<Self>;
}
Expand description

The payload of an event, read from the publisher’s pointer during the handler.

§Safety

read must accept exactly the payloads its events publish, and null (an event published without a payload, as Host::publish does), for which it reads nothing.

Required Methods§

Source

unsafe fn read(raw: *const c_void) -> Option<Self>

The payload behind raw; None when it cannot be read (e.g. null).

§Safety

raw is the payload of an event this type belongs to, valid during the call.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementations on Foreign Types§

Source§

impl Payload for ()

Source§

unsafe fn read(_raw: *const c_void) -> Option<Self>

Implementors§