pub trait GlobalStore<G>: EventSource<GlobalsUpdate<G>> {
    type Iter<'a>: Iterator<Item = (u32, &'a Rc<G>)>
       where Self: 'a,
             G: 'a;
    type InsertFut<'a, IntoG>: Future<Output = u32> + 'a
       where Self: 'a,
             IntoG: 'a + Into<G>;
    type RemoveFut<'a>: Future<Output = bool> + 'a
       where Self: 'a;

    // Required methods
    fn insert<'a, IntoG: Into<G> + 'a>(
        &'a mut self,
        global: IntoG
    ) -> Self::InsertFut<'a, IntoG>;
    fn get(&self, id: u32) -> Option<&Rc<G>>;
    fn remove(&mut self, id: u32) -> Self::RemoveFut<'_>;
    fn iter(&self) -> Self::Iter<'_>;
}
Expand description

A global store

Required Associated Types§

source

type Iter<'a>: Iterator<Item = (u32, &'a Rc<G>)> where Self: 'a, G: 'a

Type of iterator returned by Self::iter.

source

type InsertFut<'a, IntoG>: Future<Output = u32> + 'a where Self: 'a, IntoG: 'a + Into<G>

Type of future returned by Self::insert.

source

type RemoveFut<'a>: Future<Output = bool> + 'a where Self: 'a

Type of future returned by Self::remove.

Required Methods§

source

fn insert<'a, IntoG: Into<G> + 'a>( &'a mut self, global: IntoG ) -> Self::InsertFut<'a, IntoG>

Add a global to the store, return its allocated ID.

source

fn get(&self, id: u32) -> Option<&Rc<G>>

Get the global with the given id.

source

fn remove(&mut self, id: u32) -> Self::RemoveFut<'_>

Remove the global with the given id.

source

fn iter(&self) -> Self::Iter<'_>

Iterate over all the globals.

Implementors§

source§

impl<G: 'static> GlobalStore<G> for GlobalStore<G>

GlobalStore will notify listeners when globals are added or removed. The notification will be sent to the slot registered as “wl_registry”.

§

type Iter<'a> where Self: 'a, G: 'a = <&'a GlobalStore<G> as IntoIterator>::IntoIter

§

type InsertFut<'a, I> where Self: 'a, I: 'a + Into<G> = impl Future<Output = u32> + 'a

§

type RemoveFut<'a> where Self: 'a = impl Future<Output = bool> + 'a