Introduce opaque window::Id type
This commit is contained in:
parent
8fdd5ee8b6
commit
ec56c0686d
6 changed files with 48 additions and 12 deletions
|
|
@ -1,10 +1,12 @@
|
|||
//! Build window-based GUI applications.
|
||||
mod action;
|
||||
mod event;
|
||||
mod id;
|
||||
mod mode;
|
||||
mod user_attention;
|
||||
|
||||
pub use action::Action;
|
||||
pub use event::Event;
|
||||
pub use id::Id;
|
||||
pub use mode::Mode;
|
||||
pub use user_attention::UserAttention;
|
||||
|
|
|
|||
16
native/src/window/id.rs
Normal file
16
native/src/window/id.rs
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
use std::collections::hash_map::DefaultHasher;
|
||||
use std::hash::{Hash, Hasher};
|
||||
|
||||
#[derive(Debug, PartialEq, Eq, Hash)]
|
||||
/// TODO(derezzedex)
|
||||
pub struct Id(u64);
|
||||
|
||||
impl Id {
|
||||
/// TODO(derezzedex)
|
||||
pub fn new(id: impl Hash) -> Id {
|
||||
let mut hasher = DefaultHasher::new();
|
||||
id.hash(&mut hasher);
|
||||
|
||||
Id(hasher.finish())
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue