pub struct PointerIdAllocator { /* private fields */ }Expand description
Mints PointerIds and maps a backend’s reused contact ids onto them.
One instance per process, reached through PointerIdAllocator::global.
The mapping is (device, os_id) -> PointerId, established at begin and
torn down at end; get resolves the samples in between.
Implementations§
Source§impl PointerIdAllocator
impl PointerIdAllocator
Sourcepub fn begin(&self, device: BackendDeviceKey, os_id: u64) -> PointerId
pub fn begin(&self, device: BackendDeviceKey, os_id: u64) -> PointerId
Mint a fresh id for a press and remember it for (device, os_id).
A second begin on a key that is already live replaces the mapping
and returns a new id — a backend that drops an Up (a lost contact, a
window that stopped receiving events mid-gesture) must not strand the
next press on the old identity.
Sourcepub fn end(&self, device: BackendDeviceKey, os_id: u64) -> Option<PointerId>
pub fn end(&self, device: BackendDeviceKey, os_id: u64) -> Option<PointerId>
Forget the mapping for a lifted contact. Idempotent; returns the id that was live, if any.
Sourcepub fn live_count(&self) -> usize
pub fn live_count(&self) -> usize
Number of contacts currently mapped. Test/diagnostic helper.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for PointerIdAllocator
impl RefUnwindSafe for PointerIdAllocator
impl Send for PointerIdAllocator
impl Sync for PointerIdAllocator
impl Unpin for PointerIdAllocator
impl UnsafeUnpin for PointerIdAllocator
impl UnwindSafe for PointerIdAllocator
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