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§

source

type Object: AnyObject

Type of the proxy object for this global. Since this global is polymorphic, the type of the proxy object is also polymorphic. This should match the object type you have in you Client trait implementation.

Required Methods§

source

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.

source

fn interface(&self) -> &'static str

The interface name of this global.

source

fn version(&self) -> u32

The version number of this global.

source

fn cast<T: 'static>(&self) -> Option<&T>where Self: 'static + Sized,

Cast this polymorphic global to a more concrete type.

Implementors§