pub unsafe trait EspEventSource {
    // Required method
    fn source() -> Option<&'static CStr>;

    // Provided method
    fn event_id() -> Option<i32> { ... }
}
Expand description

§Safety

By implementing this trait, the user guarantees that the binary format serialized/deserialized by EspTypedEventSerializer and EspTypedEventDeserializer is indeed THE binary format that stands behind the source ID returned by the source method in this trait (and that other producers/consumers of the ESP IDF event loop also recognize as the binary format corresponbding to this source ID).

Providing the wrong source ID for a binary format, or the wrong binary format for a given source ID would lead to a runtime crash, hence this trait can only be implemented unsafely, as the guarantee lies with the user and not with the compiler, that cannot enforce this contract.

Required Methods§

source

fn source() -> Option<&'static CStr>

Provided Methods§

source

fn event_id() -> Option<i32>

Object Safety§

This trait is not object safe.

Implementors§