1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-31 05:40:03 -04:00

Various small improvements

This commit is contained in:
Emil Ernerfeldt
2020-04-21 20:48:31 +02:00
parent a56a869f48
commit 4efbb94e1b
8 changed files with 60 additions and 36 deletions

View File

@@ -43,14 +43,14 @@ impl Id {
Self(1)
}
pub fn new<H: Hash>(source: &H) -> Id {
pub fn new<H: Hash>(source: H) -> Id {
use std::hash::Hasher;
let mut hasher = DefaultHasher::new();
source.hash(&mut hasher);
Id(hasher.finish())
}
pub fn with<H: Hash>(self, child: &H) -> Id {
pub fn with<H: Hash>(self, child: H) -> Id {
use std::hash::Hasher;
let mut hasher = DefaultHasher::new();
hasher.write_u64(self.0);