[][src]Struct wayland_commons::map::ObjectMap

pub struct ObjectMap<Meta: ObjectMetadata> { /* fields omitted */ }

A holder for the object store of a connection

Keeps track of which object id is associated to which interface object, and which is currently unused.

Methods

impl<Meta: ObjectMetadata> ObjectMap<Meta>[src]

pub fn new() -> ObjectMap<Meta>[src]

Create a new empty object map

pub fn find(&self, id: u32) -> Option<Object<Meta>>[src]

Find an object in the store

pub fn remove(&mut self, id: u32)[src]

Remove an object from the store

Does nothing if the object didn't previously exists

pub fn insert_at(&mut self, id: u32, object: Object<Meta>) -> Result<(), ()>[src]

Insert given object for given id

Can fail if the requested id is not the next free id of this store. (In which case this is a protocol error)

pub fn client_insert_new(&mut self, object: Object<Meta>) -> u32[src]

Allocate a new id for an object in the client namespace

pub fn server_insert_new(&mut self, object: Object<Meta>) -> u32[src]

Allocate a new id for an object in the server namespace

pub fn with<T, F: FnOnce(&mut Object<Meta>) -> T>(
    &mut self,
    id: u32,
    f: F
) -> Result<T, ()>
[src]

Mutably access an object of the map

pub fn with_all<F: FnMut(u32, &mut Object<Meta>)>(&mut self, f: F)[src]

Mutably access all objects of the map in sequence

Auto Trait Implementations

impl<Meta> Send for ObjectMap<Meta> where
    Meta: Send

impl<Meta> Sync for ObjectMap<Meta> where
    Meta: Sync

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]