Trait runa_core::objects::MonoObject
source · 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§
sourcetype SingletonState: 'static
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§
Required Methods§
sourcefn new_singleton_state() -> Self::SingletonState
fn new_singleton_state() -> Self::SingletonState
Create a new instance of the singleton state.