1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
pub(super) fn u32_to_i32(value: u32) -> i32 { i32::try_from(value).unwrap_or(i32::MAX) } pub(super) fn i32_to_u32(value: i32) -> u32 { u32::try_from(value).unwrap_or_default() } pub(in crate::transform::images) fn positive_i32_to_u32(value: i32) -> Option<u32> { u32::try_from(value).ok().filter(|value| *value > 0) } pub(super) fn i64_to_u32(value: i64) -> u32 { u32::try_from(value).unwrap_or_default() } pub(super) fn usize_to_i32(value: usize) -> i32 { i32::try_from(value).unwrap_or(i32::MAX) }