scale: make wl representation private
This commit is contained in:
parent
355a9eb240
commit
bc9b1c3638
5 changed files with 22 additions and 7 deletions
10
src/scale.rs
10
src/scale.rs
|
|
@ -5,7 +5,7 @@ const BASEF: f64 = BASE as f64;
|
|||
|
||||
#[derive(Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)]
|
||||
#[repr(transparent)]
|
||||
pub struct Scale(pub u32);
|
||||
pub struct Scale(u32);
|
||||
|
||||
impl Scale {
|
||||
pub fn from_int(f: u32) -> Self {
|
||||
|
|
@ -23,6 +23,14 @@ impl Scale {
|
|||
pub fn round_up(self) -> u32 {
|
||||
self.0.saturating_add(BASE - 1) / BASE
|
||||
}
|
||||
|
||||
pub fn from_wl(wl: u32) -> Self {
|
||||
Self(wl)
|
||||
}
|
||||
|
||||
pub fn to_wl(self) -> u32 {
|
||||
self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl PartialEq<u32> for Scale {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue