pub struct MonitorId(/* private fields */);Expand description
Unique identifier of a monitor screen.
§Memory
The internal number is a NonZeroU32, that means that
Option<MonitorId>
and
MonitorId
are the same size as u32.
§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 a modified
splitmix64.
§Static
The unique ID cannot be generated at compile time, but you can use the new_static constructor to
create a lightweight lazy ID factory that will generate the ID on the first get.
Implementations§
source§impl MonitorId
impl MonitorId
sourcepub fn new_unique() -> Self
pub fn new_unique() -> Self
Generates a new unique ID.
sourcepub const fn new_static() -> StaticMonitorId
pub const fn new_static() -> StaticMonitorId
New static ID that will be generated on the first get.
sourcepub fn sequential(self) -> u32
pub fn sequential(self) -> u32
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: u32) -> Self
pub fn from_raw(raw: u32) -> Self
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: u32) -> Self
pub fn from_sequential(num: u32) -> Self
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.
Trait Implementations§
source§impl From<&'static StaticMonitorId> for MonitorId
impl From<&'static StaticMonitorId> for MonitorId
source§fn from(st: &'static StaticMonitorId) -> MonitorId
fn from(st: &'static StaticMonitorId) -> MonitorId
source§impl PartialEq for MonitorId
impl PartialEq for MonitorId
impl Copy for MonitorId
impl Eq for MonitorId
impl NoUninit for MonitorId
impl PodInOption for MonitorId
impl ZeroableInOption 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> AnyVarValue for Twhere
T: VarValue,
impl<T> AnyVarValue for Twhere
T: VarValue,
source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
dyn Any methods.source§fn clone_boxed(&self) -> Box<dyn AnyVarValue>
fn clone_boxed(&self) -> Box<dyn AnyVarValue>
source§fn clone_boxed_var(&self) -> Box<dyn AnyVar>
fn clone_boxed_var(&self) -> Box<dyn AnyVar>
LocalVar<Self>.