Skip to main content

OwnEventEmitter

Trait OwnEventEmitter 

Source
pub trait OwnEventEmitter {
    // Required method
    fn emit_own_event<F>(
        &self,
        event_id: u32,
        priority: EventPriority,
        f: F,
    ) -> Result<u64, Error>
       where F: FnOnce(EventTLVWrite<'_>) -> Result<(), Error>;
}
Expand description

A trait for emitting events typically implemented on types that have a notion of a “current” endpoint and a “current” cluster.

Required Methods§

Source

fn emit_own_event<F>( &self, event_id: u32, priority: EventPriority, f: F, ) -> Result<u64, Error>
where F: FnOnce(EventTLVWrite<'_>) -> Result<(), Error>,

Emit an event with the same endpoint ID and cluster ID as the current operation.

This is a convenience method that calls emit_event with the endpoint ID and cluster ID of the current operation, so that the caller doesn’t have to specify them again.

§Arguments
  • event_id: The event ID of the event being emitted.
  • priority: The priority of the event.
  • f: A closure that takes an EventTLVWrite and writes the event data into it using TLV encoding.
§Returns
  • Ok(EventNumber): The sequence number of the emitted event, if the event was successfully emitted.
  • Err(Error): An error if the event could not be emitted.

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<T> OwnEventEmitter for &T
where T: OwnEventEmitter,

Source§

fn emit_own_event<F>( &self, event_id: u32, priority: EventPriority, f: F, ) -> Result<u64, Error>
where F: FnOnce(EventTLVWrite<'_>) -> Result<(), Error>,

Implementors§