add util functors for is_zero/is_equal; move clamp to math utils

Signed-off-by: Jason Volk <jason@zemos.net>
This commit is contained in:
Jason Volk 2024-09-13 18:24:33 +00:00 committed by strawberry
parent bd75ff65c9
commit 63053640f1
3 changed files with 39 additions and 15 deletions

View file

@ -41,8 +41,5 @@ pub(crate) fn camel_to_snake_string(s: &str) -> String {
output
}
pub(crate) fn exchange<T: Clone>(state: &mut T, source: T) -> T {
let ret = state.clone();
*state = source;
ret
}
#[inline]
pub(crate) fn exchange<T>(state: &mut T, source: T) -> T { std::mem::replace(state, source) }