Struct x11rb_protocol::id_allocator::IdAllocator
source · pub struct IdAllocator { /* private fields */ }
Expand description
An allocator for X11 IDs.
This struct handles the client-side generation of X11 IDs. The ID allocation is based on a range of IDs that the server assigned us. This range is described by a base and a mask. From the X11 protocol reference manual:
The resource-id-mask contains a single contiguous set of bits (at least 18). The client allocates resource IDs [..] by choosing a value with only some subset of these bits set and ORing it with resource-id-base.
Implementations§
source§impl IdAllocator
impl IdAllocator
sourcepub fn new(id_base: u32, id_mask: u32) -> Result<Self, ConnectError>
pub fn new(id_base: u32, id_mask: u32) -> Result<Self, ConnectError>
Create a new instance of an ID allocator.
The arguments should be the resource_id_base
and resource_id_mask
values that the X11
server sent in a Setup
response.
sourcepub fn update_xid_range(
&mut self,
xidrange: &GetXIDRangeReply
) -> Result<(), IdsExhausted>
pub fn update_xid_range( &mut self, xidrange: &GetXIDRangeReply ) -> Result<(), IdsExhausted>
Update the available range of IDs based on a GetXIDRangeReply
sourcepub fn generate_id(&mut self) -> Option<u32>
pub fn generate_id(&mut self) -> Option<u32>
Generate the next ID.
Trait Implementations§
source§impl Clone for IdAllocator
impl Clone for IdAllocator
source§fn clone(&self) -> IdAllocator
fn clone(&self) -> IdAllocator
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for IdAllocator
impl Debug for IdAllocator
impl Copy for IdAllocator
Auto Trait Implementations§
impl RefUnwindSafe for IdAllocator
impl Send for IdAllocator
impl Sync for IdAllocator
impl Unpin for IdAllocator
impl UnwindSafe for IdAllocator
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more