pub struct InputDeviceId(/* private fields */);Expand description
Unique identifier of an input device event source.
§Memory
The internal number is a NonZeroU64, that means that
Option<InputDeviceId>
and
InputDeviceId
are the same size as u64.
§As Hash
The generated internal number has good statistical distribution and can be used as its own hash,
although it is not cryptographically safe, as it is simply a sequential counter scrambled using splitmix64.
§Static
The unique ID cannot be generated at compile time, but you can use the static_id! macro to declare
a lazy static that instantiates the ID.
§Exhaustion Handling
If more IDs are generated them u64::MAX an error is logged, the internal counter is reset and ids are reused.
Implementations§
Source§impl InputDeviceId
impl InputDeviceId
Sourcepub fn new_unique() -> InputDeviceId
pub fn new_unique() -> InputDeviceId
Generates a new unique ID.
Sourcepub fn sequential(self) -> u64
pub fn sequential(self) -> u64
Un-scramble the underlying value to get the original sequential count number.
If two IDs, id0 and id1 where generated by the same thread then id0.sequential() < id1.sequential().
Sourcepub fn from_raw(raw: u64) -> InputDeviceId
pub fn from_raw(raw: u64) -> InputDeviceId
Creates an ID from a raw value.
The value must not be zero, panics if it is, the value must have been provided by get otherwise
the ID will not be unique.
Sourcepub fn from_sequential(num: u64) -> InputDeviceId
pub fn from_sequential(num: u64) -> InputDeviceId
Creates an ID from a sequential number.
§Safety
The value must not be zero, panics if it is, the value must have been provided by sequential otherwise
the ID will not be unique.
Source§impl InputDeviceId
impl InputDeviceId
Sourcepub fn virtual_keyboard() -> InputDeviceId
pub fn virtual_keyboard() -> InputDeviceId
Virtual keyboard ID used in keyboard events generated by code.
Sourcepub fn virtual_mouse() -> InputDeviceId
pub fn virtual_mouse() -> InputDeviceId
Virtual mouse ID used in mouse events generated by code.
Sourcepub fn virtual_generic() -> InputDeviceId
pub fn virtual_generic() -> InputDeviceId
Virtual generic device ID used in device events generated by code.
Trait Implementations§
Source§impl Clone for InputDeviceId
impl Clone for InputDeviceId
Source§fn clone(&self) -> InputDeviceId
fn clone(&self) -> InputDeviceId
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for InputDeviceId
impl Debug for InputDeviceId
Source§impl Display for InputDeviceId
impl Display for InputDeviceId
Source§impl Hash for InputDeviceId
impl Hash for InputDeviceId
Source§impl PartialEq for InputDeviceId
impl PartialEq for InputDeviceId
Source§impl UniqueId for InputDeviceId
impl UniqueId for InputDeviceId
Source§fn new_unique() -> InputDeviceId
fn new_unique() -> InputDeviceId
impl Copy for InputDeviceId
impl Eq for InputDeviceId
impl NoUninit for InputDeviceId
impl PodInOption for InputDeviceId
impl ZeroableInOption for InputDeviceId
Auto Trait Implementations§
impl Freeze for InputDeviceId
impl RefUnwindSafe for InputDeviceId
impl Send for InputDeviceId
impl Sync for InputDeviceId
impl Unpin for InputDeviceId
impl UnwindSafe for InputDeviceId
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
Source§impl<T> AnyVarValue for T
impl<T> AnyVarValue for T
Source§fn clone_boxed(&self) -> BoxAnyVarValue
fn clone_boxed(&self) -> BoxAnyVarValue
Source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
self and other are equal.Source§fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
other if both are of the same type.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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> DataNoteValue for T
impl<T> DataNoteValue for T
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Source§impl<T> FsChangeNote for T
impl<T> FsChangeNote for T
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<T> Separable for Twhere
T: Display,
impl<T> Separable for Twhere
T: Display,
Source§fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
fn separate_by_policy(&self, policy: SeparatorPolicy<'_>) -> String
SeparatorPolicy. Read more