pub trait AnyGlobal {
type Object: AnyObject;
// Required methods
fn new_object(&self) -> Self::Object;
fn interface(&self) -> &'static str;
fn version(&self) -> u32;
fn cast<T: 'static>(&self) -> Option<&T>
where Self: 'static + Sized;
}
Expand description
A polymorphic global
This is analogous to the AnyObject
trait for
objects, as well as the Any
trait.
Typically a polymorphic global type will be a enum of all the global types
used in the compositor. If you have such an enum, the
globals!
macro will generate this trait impl for you.
Unlike AnyObject
, this trait doesn’t have a cast_mut
method because
globals are shared so it’s not possible to get a unique reference to them.
Required Associated Types§
Required Methods§
sourcefn new_object(&self) -> Self::Object
fn new_object(&self) -> Self::Object
Create a proxy of this global, called when the client tries to bound
the global. The new proxy object will be incomplete until Bind::bind
is called with that object.