diff options
Diffstat (limited to 'native/src')
-rw-r--r-- | native/src/window.rs | 2 | ||||
-rw-r--r-- | native/src/window/id.rs | 16 |
2 files changed, 18 insertions, 0 deletions
diff --git a/native/src/window.rs b/native/src/window.rs index 1b97e655..dc9e2d66 100644 --- a/native/src/window.rs +++ b/native/src/window.rs @@ -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; diff --git a/native/src/window/id.rs b/native/src/window/id.rs new file mode 100644 index 00000000..56496aaa --- /dev/null +++ b/native/src/window/id.rs @@ -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()) + } +} |