Struct wayland_client::GlobalManager
source · pub struct GlobalManager { /* private fields */ }
Expand description
An utility to manage global objects
This utility provides an implemenation for the registry that track the list of globals for you, as well as utilities to bind them.
Implementations
sourceimpl GlobalManager
impl GlobalManager
sourcepub fn new(display: &Proxy<WlDisplay>) -> GlobalManager
pub fn new(display: &Proxy<WlDisplay>) -> GlobalManager
Create a global manager handling a registry
sourcepub fn new_with_cb<F>(display: &Proxy<WlDisplay>, callback: F) -> GlobalManagerwhere
F: FnMut(GlobalEvent, Proxy<WlRegistry>) + Send + 'static,
pub fn new_with_cb<F>(display: &Proxy<WlDisplay>, callback: F) -> GlobalManagerwhere
F: FnMut(GlobalEvent, Proxy<WlRegistry>) + Send + 'static,
Create a global manager handling a registry with a callback
This global manager will track globals as a simple one, but will also forward the registry events to your callback.
This can be used if you want to handle specially certain globals, but want to use the default mechanism for the rest.
sourcepub fn instantiate_auto<I: Interface, F>(
&self,
implementor: F
) -> Result<Proxy<I>, GlobalError>where
F: FnOnce(NewProxy<I>) -> Proxy<I>,
pub fn instantiate_auto<I: Interface, F>(
&self,
implementor: F
) -> Result<Proxy<I>, GlobalError>where
F: FnOnce(NewProxy<I>) -> Proxy<I>,
Instantiate a global with highest available version
This method is only appropriate for globals that are expected to
not exist with multiplicity (such as wl_compositor
or wl_shm
),
as it will only bind a single one.
sourcepub fn instantiate_exact<I: Interface, F>(
&self,
version: u32,
implementor: F
) -> Result<Proxy<I>, GlobalError>where
F: FnOnce(NewProxy<I>) -> Proxy<I>,
pub fn instantiate_exact<I: Interface, F>(
&self,
version: u32,
implementor: F
) -> Result<Proxy<I>, GlobalError>where
F: FnOnce(NewProxy<I>) -> Proxy<I>,
Instantiate a global with a specific version
Like instantiate_auto
, but will bind a specific version of
this global an not the highest available.
Trait Implementations
sourceimpl Clone for GlobalManager
impl Clone for GlobalManager
sourcefn clone(&self) -> GlobalManager
fn clone(&self) -> GlobalManager
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations
impl !RefUnwindSafe for GlobalManager
impl Send for GlobalManager
impl Sync for GlobalManager
impl Unpin for GlobalManager
impl !UnwindSafe for GlobalManager
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
sourceimpl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
sourcefn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read moresourcefn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read moresourcefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read moresourcefn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more