Struct wayland_commons::map::ObjectMap [−][src]
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]
impl<Meta: ObjectMetadata> ObjectMap<Meta>
pub fn new() -> ObjectMap<Meta>
[src]
pub fn new() -> ObjectMap<Meta>
Create a new empty object map
pub fn find(&self, id: u32) -> Option<Object<Meta>>
[src]
pub fn find(&self, id: u32) -> Option<Object<Meta>>
Find an object in the store
pub fn remove(&mut self, id: u32)
[src]
pub fn remove(&mut self, id: u32)
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]
pub fn insert_at(&mut self, id: u32, object: Object<Meta>) -> Result<(), ()>
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]
pub fn client_insert_new(&mut self, object: Object<Meta>) -> u32
Allocate a new id for an object in the client namespace
pub fn server_insert_new(&mut self, object: Object<Meta>) -> u32
[src]
pub fn server_insert_new(&mut self, object: Object<Meta>) -> u32
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]
pub fn with<T, F: FnOnce(&mut Object<Meta>) -> T>(
&mut self,
id: u32,
f: F
) -> Result<T, ()>
Mutably access an object of the map
pub fn with_all<F: FnMut(u32, &mut Object<Meta>)>(&mut self, f: F)
[src]
pub fn with_all<F: FnMut(u32, &mut Object<Meta>)>(&mut self, f: F)
Mutably access all objects of the map in sequence