Skip to content

Commit

Permalink
refactor(stateful-image): turn resize into const and make a const fn …
Browse files Browse the repository at this point in the history
…new function
  • Loading branch information
TadoTheMiner authored and benjajaja committed Jan 6, 2025
1 parent f0ca1d9 commit 8feb99a
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -186,9 +186,14 @@ pub struct StatefulImage {
}

impl StatefulImage {
pub fn resize(mut self, resize: Resize) -> StatefulImage {
self.resize = resize;
self
pub const fn resize(self, resize: Resize) -> Self {
Self { resize }
}

pub const fn new() -> Self {
Self {
resize: Resize::Fit(None),
}
}
}

Expand Down

0 comments on commit 8feb99a

Please sign in to comment.