pub trait MonoObject: 'static {
    type SingletonState: 'static;

    const INTERFACE: &'static str;

    // Required method
    fn new_singleton_state() -> Self::SingletonState;
}
Expand description

An monomorphic object, i.e. it’s a single object whose interface is known, as opposed to AnyObject.

This is deliberately separate from Object to keep it away from the pollution of the Ctx parameter.

This trait is automatically derived by the #[wayland_object] macro.

Note

If the object is a proxy of a global, it has to recognize if the global’s lifetime has ended, and turn all message sent to it to no-ops. This can often be achieved by holding a Weak reference to the global object.

Required Associated Types§

source

type SingletonState: 'static

A singleton state associated with the object type. This state is associated with the type, so there is only one instance of the state for all objects of the same type. The lifetime of this state is managed by the object store, and it will be dropped when the last object of the type is dropped.

Required Associated Constants§

source

const INTERFACE: &'static str

The wayland interface implemented by this object.

Required Methods§

source

fn new_singleton_state() -> Self::SingletonState

Create a new instance of the singleton state.

Implementors§

source§

impl MonoObject for Callback

§

type SingletonState = ()

source§

const INTERFACE: &'static str = runa_wayland_protocols::wayland::wl_callback::v1::NAME

source§

impl MonoObject for Display

§

type SingletonState = ()

source§

const INTERFACE: &'static str = wl_display::NAME

source§

impl MonoObject for Registry

§

type SingletonState = ()

source§

const INTERFACE: &'static str = wl_registry::NAME