Skip to main content

const_zmij/
const_range.rs

1use core::ops::RangeInclusive;
2
3pub(crate) struct ConstRange<T>(pub T);
4
5impl ConstRange<RangeInclusive<i32>> {
6    /// const version of [`RangeInclusive::contains`]
7    #[allow(clippy::trivially_copy_pass_by_ref)]
8    #[inline]
9    pub(crate) const fn contains(&self, item: &i32) -> bool {
10        let Self(this) = self;
11        *this.start() <= *item && *item <= *this.end()
12    }
13}