pub struct GlobalManager {
    inner: Arc<Mutex<Inner>>,
    registry: Main<WlRegistry>,
}
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.

Fields§

§inner: Arc<Mutex<Inner>>§registry: Main<WlRegistry>

Implementations§

source§

impl GlobalManager

source

pub fn new(display: &Attached<WlDisplay>) -> GlobalManager

Create a global manager handling a registry

You need to provide an attached handle of the Waland display, and the global manager will be managed by the associated event queue.

source

pub fn new_with_cb<F>( display: &Attached<WlDisplay>, callback: F ) -> GlobalManagerwhere F: FnMut(GlobalEvent, Attached<WlRegistry>, DispatchData<'_>) + '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.

You need to provide an attached handle of the Waland display, and the global manager will be managed by the associated event queue.

source

pub fn instantiate_exact<I>(&self, version: u32) -> Result<Main<I>, GlobalError>where I: Interface + AsRef<Proxy<I>> + From<Proxy<I>>,

Instantiate a global with a specific version

Meaning of requests and events can change depending on the object version you use, as such unless you specifically want to support several versions of a protocol, it is recommended to use this method with an hardcoded value for the version (the one you’ll use a as reference for your implementation). Notably you should not use I::VERSION as a version, as this value can change when the protocol files are updated.

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 always bind the first one that was advertized.

source

pub fn instantiate_range<I>( &self, min_version: u32, max_version: u32 ) -> Result<Main<I>, GlobalError>where I: Interface + AsRef<Proxy<I>> + From<Proxy<I>>,

Instantiate a global from a version range

If you want to support several versions of a particular global, this method allows you to specify a range of versions that you accept. It’ll bind the highest possible version that is between min_version and max_version inclusive, and return an error if the highest version supported by the compositor is lower than min_version. As for instantiate_exact, you should not use I::VERSION here: the versions your code support do not change when the protocol files are updated.

When trying to support several versions of a protocol, you can check which version has actually been used on any object using the Proxy::version() method.

As instantiate_exact, it should only be used for singleton globals, for the same reasons.

source

pub fn list(&self) -> Vec<(u32, String, u32)>

Retrieve the list of currently known globals

Trait Implementations§

source§

impl Clone for GlobalManager

source§

fn clone(&self) -> GlobalManager

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for GlobalManager

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.