Trait wayland_commons::Implementation [] [src]

pub trait Implementation<Meta, Msg>: Downcast {
    fn receive(&mut self, msg: Msg, meta: Meta);
}

Trait representing implementations for wayland objects

Several wayland objects require you to act when some messages are received. You program this act by providing an object implementing this trait.

The trait requires a single method: self.receive(message, metadata). the message argument will often be an enum of the possible messages, and the metadata argument contains associated information. Typically an handle to the wayland object that received this message.

The trait is automatically implemented for FnMut(Msg, Meta) closures.

This is mostly used as a trait object in wayland-client and wayland-server, and thus also provide methods providing Any-like downcasting functionnality. See also the downcast_impl freestanding function.

Required Methods

Receive a message

Methods

impl<Meta, Msg> Implementation<Meta, Msg> where
    Meta: Any + 'static,
    Msg: Any + 'static, 

Returns true if the boxed type is the same as __T.

Returns a reference to the boxed value if it is of type __T, or None if it isn't.

Returns a mutable reference to the boxed value if it is of type __T, or None if it isn't.

Implementors