diff options
author | cc <cc@localhost> | 2025-08-28 02:07:47 -0700 |
---|---|---|
committer | cc <cc@localhost> | 2025-08-28 02:09:21 -0700 |
commit | d411b9e6a2b6c185921e2479ba5cd6e2010d5473 (patch) | |
tree | c230ab3cf2bb3db104a284e6c7058b1439a83753 /src/label_format.rs | |
parent | b2bb714ad8287a33a1ee399999e340471b0bb4b4 (diff) |
Pin breaking update
Better trait
Diffstat (limited to 'src/label_format.rs')
-rw-r--r-- | src/label_format.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/label_format.rs b/src/label_format.rs index c127e81..254cbd6 100644 --- a/src/label_format.rs +++ b/src/label_format.rs @@ -4,18 +4,18 @@ use crate::flood; use crate::color; pub trait LabelU16 { - fn zero(&self) -> Self; + fn is_zero(&self) -> bool; } impl LabelU16 for u16 { - fn zero(&self) -> Self { - 0u16 + fn is_zero(&self) -> bool { + *self == 0u16 } } impl LabelU16 for u32 { - fn zero(&self) -> Self { - 0u32 + fn is_zero(&self) -> bool { + *self == 0u32 } } @@ -41,7 +41,7 @@ impl<T: LabelU16 + PartialEq + Copy> LabelFormat<T> { for y in 0..self.height { for x in 0..self.width { let index = x + y*self.width; - if self.buffer[index] == self.buffer[index].zero() { + if self.buffer[index].is_zero() { continue; } if output_buffer[index] == 0 { |