#[repr(C)]pub struct MonitorId {
pub index: usize,
pub hash: u64,
}Expand description
Identifies a specific monitor/display
Contains both an index (for fast current-session lookup) and a stable hash (for persistence across app restarts and monitor reconfigurations).
index: Runtime index (0-based), may change if monitors are added/removedhash: Stable identifier based on monitor properties (name, size, position)
Applications can serialize hash to remember which monitor a window was on,
then search for matching hash on next launch, falling back to index or PRIMARY.
Fields§
§index: usizeRuntime index of the monitor (may change between sessions)
hash: u64Stable hash of monitor properties (for persistence)
Implementations§
Source§impl MonitorId
impl MonitorId
Sourcepub const fn from_index_and_hash(index: usize, hash: u64) -> Self
pub const fn from_index_and_hash(index: usize, hash: u64) -> Self
Create a MonitorId from index and hash
Sourcepub fn from_properties(
index: usize,
name: &str,
position: LayoutPoint,
size: LayoutSize,
) -> Self
pub fn from_properties( index: usize, name: &str, position: LayoutPoint, size: LayoutSize, ) -> Self
Create a stable monitor ID from monitor properties
Uses FNV-1a hash of: name + position + size This ensures the hash is stable across app restarts as long as the monitor configuration doesn’t change significantly
Trait Implementations§
Source§impl Ord for MonitorId
impl Ord for MonitorId
Source§impl PartialOrd for MonitorId
impl PartialOrd for MonitorId
impl Copy for MonitorId
impl Eq for MonitorId
impl StructuralPartialEq for MonitorId
Auto Trait Implementations§
impl Freeze for MonitorId
impl RefUnwindSafe for MonitorId
impl Send for MonitorId
impl Sync for MonitorId
impl Unpin for MonitorId
impl UnwindSafe for MonitorId
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,
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>
Converts
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>
Converts
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