Struct wayland_commons::map::ObjectMap [−][src]
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.
Implementations
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]
&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]
Mutably access all objects of the map in sequence
Trait Implementations
impl<Meta: Default + ObjectMetadata> Default for ObjectMap<Meta>
[src]
Auto Trait Implementations
impl<Meta> RefUnwindSafe for ObjectMap<Meta> where
Meta: RefUnwindSafe,
Meta: RefUnwindSafe,
impl<Meta> Send for ObjectMap<Meta> where
Meta: Send,
Meta: Send,
impl<Meta> Sync for ObjectMap<Meta> where
Meta: Sync,
Meta: Sync,
impl<Meta> Unpin for ObjectMap<Meta> where
Meta: Unpin,
Meta: Unpin,
impl<Meta> UnwindSafe for ObjectMap<Meta> where
Meta: UnwindSafe,
Meta: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,