Skip to main content

PointerTable

Struct PointerTable 

Source
pub struct PointerTable { /* private fields */ }
Expand description

Fixed-capacity active pointer table (see the module docs).

Implementations§

Source§

impl PointerTable

Source

pub const fn len(&self) -> usize

Source

pub const fn is_empty(&self) -> bool

Source

pub fn set_limit(&mut self, limit: usize)

Caps simultaneously tracked pointers (1..=MAX_ACTIVE_POINTERS); live slots stay.

Source

pub fn get(&self, key: PointerKey) -> Option<&PointerSlot>

Source

pub fn get_mut(&mut self, key: PointerKey) -> Option<&mut PointerSlot>

Source

pub fn iter(&self) -> impl Iterator<Item = &PointerSlot>

Live slots in slot order.

Source

pub fn primary(&self) -> Option<&PointerSlot>

The first active primary slot.

Source

pub fn would_be_primary(&self, key: PointerKey) -> bool

W3C primary rule: the mouse is always primary; a pen or touch contact is primary when no other pointer of its kind is active.

Source

pub fn begin( &mut self, key: PointerKey, at: [f32; 2], ts: TimestampUs, target: NodeId, ) -> Result<&mut PointerSlot, PointerOverflow>

Activates key (no-op returning the slot when already active).

Source

pub fn end(&mut self, key: PointerKey) -> Option<PointerSlot>

Ends key, returning its final slot.

Source

pub fn capture_now( &mut self, key: PointerKey, node: NodeId, claimed: bool, ) -> Result<(), CaptureError>

Captures key to node immediately (implicit / declarative capture at down).

Source

pub fn set_capture( &mut self, key: PointerKey, node: NodeId, ) -> Result<(), CaptureError>

W3C setPointerCapture: sets key’s pending capture target (node must be valid for the caller, see CaptureError::InvalidTarget).

Source

pub fn release_capture( &mut self, key: PointerKey, node: NodeId, ) -> Result<(), CaptureError>

W3C releasePointerCapture: clears key’s pending capture when node holds it (or any node when node is NULL).

Source

pub fn has_capture(&self, key: PointerKey, node: NodeId) -> bool

W3C hasPointerCapture: node is key’s pending capture target.

Source

pub fn capture_of(&self, key: PointerKey) -> Option<NodeId>

Current capture target of key.

Source

pub fn process_pending_capture(&mut self, key: PointerKey) -> CaptureTransition

Applies key’s pending capture; an app request (anything but the implicit target) becomes a claim.

Source

pub fn prune_captures(&mut self, drop: impl FnMut(NodeId) -> bool) -> bool

Drops capture (current and pending) on every slot where drop(node) holds; returns whether anything changed.

Source

pub fn clear(&mut self)

Ends every slot.

Source

pub fn keys(&self) -> ([PointerKey; 10], usize)

Keys of every live slot (copied out so callers can mutate while iterating).

Trait Implementations§

Source§

impl Clone for PointerTable

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PointerTable

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for PointerTable

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.