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
sourceimpl 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
sourceimpl Clone for IdAllocator
impl Clone for IdAllocator
sourcefn clone(&self) -> IdAllocator
fn clone(&self) -> IdAllocator
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more