Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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
TadoTheMiner committed Jan 2, 2025

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
1 parent 71da651 commit 24ac31b
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
@@ -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),
}
}
}

0 comments on commit 24ac31b

Please sign in to comment.