pub struct DpiCapabilities { /* private fields */ }Expand description
Supported DPI values reported by a device’s HID++ AdjustableDpi feature.
Implementations§
Source§impl DpiCapabilities
impl DpiCapabilities
Sourcepub fn new(values: Vec<u16>) -> Result<Self, WriteError>
pub fn new(values: Vec<u16>) -> Result<Self, WriteError>
Build capabilities from a device-reported DPI list. Values are sorted and deduplicated so callers can rely on stable ordering.
Sourcepub fn snap(&self, dpi: u32) -> u32
pub fn snap(&self, dpi: u32) -> u32
Snap dpi to the nearest supported value, widened to u32 for UI math.
The single home for “round a DPI onto this device’s grid” — callers that
hold an Option<DpiCapabilities> should map_or(dpi, |c| c.snap(dpi)).
Sourcepub fn step_hint(&self) -> u16
pub fn step_hint(&self) -> u16
Best-effort step size for UI widgets that need a single increment. Returns the smallest positive gap between adjacent reported values.
Sourcepub fn adjacent_test_target(&self, current: u16) -> Option<u16>
pub fn adjacent_test_target(&self, current: u16) -> Option<u16>
A supported value different from current, for diagnostic write tests.
Trait Implementations§
Source§impl Clone for DpiCapabilities
impl Clone for DpiCapabilities
Source§fn clone(&self) -> DpiCapabilities
fn clone(&self) -> DpiCapabilities
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 DpiCapabilities
impl Debug for DpiCapabilities
Source§impl<'de> Deserialize<'de> for DpiCapabilities
impl<'de> Deserialize<'de> for DpiCapabilities
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for DpiCapabilities
Source§impl PartialEq for DpiCapabilities
impl PartialEq for DpiCapabilities
Source§fn eq(&self, other: &DpiCapabilities) -> bool
fn eq(&self, other: &DpiCapabilities) -> bool
Tests for
self and other values to be equal, and is used by ==.Source§impl Serialize for DpiCapabilities
impl Serialize for DpiCapabilities
impl StructuralPartialEq for DpiCapabilities
Auto Trait Implementations§
impl Freeze for DpiCapabilities
impl RefUnwindSafe for DpiCapabilities
impl Send for DpiCapabilities
impl Sync for DpiCapabilities
impl Unpin for DpiCapabilities
impl UnsafeUnpin for DpiCapabilities
impl UnwindSafe for DpiCapabilities
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.