Trait RangePattern

Source
pub trait RangePattern {
    const MIN: Self;
    const MAX: Self;

    // Required method
    const fn sub_one(self) -> Self;
}
🔬This is a nightly-only experimental API. (pattern_type_range_trait)
Expand description

A trait implemented for integer types and char. Useful in the future for generic pattern types, but used right now to simplify ast lowering of pattern type ranges.

Required Associated Constants§

Source

const MIN: Self

🔬This is a nightly-only experimental API. (pattern_type_range_trait)

Trait version of the inherent MIN assoc const.

Source

const MAX: Self

🔬This is a nightly-only experimental API. (pattern_type_range_trait)

Trait version of the inherent MIN assoc const.

Required Methods§

Source

const fn sub_one(self) -> Self

🔬This is a nightly-only experimental API. (pattern_type_range_trait)

A compile-time helper to subtract 1 for exclusive ranges.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl RangePattern for char

Source§

const MIN: char = '\0'

Source§

const MAX: char = '\u{10ffff}'

Source§

impl RangePattern for i8

Source§

const MIN: i8 = -128i8

Source§

const MAX: i8 = 127i8

Source§

impl RangePattern for i16

Source§

const MIN: i16 = -32_768i16

Source§

const MAX: i16 = 32_767i16

Source§

impl RangePattern for i32

Source§

const MIN: i32 = -2_147_483_648i32

Source§

const MAX: i32 = 2_147_483_647i32

Source§

impl RangePattern for i64

Source§

const MIN: i64 = -9_223_372_036_854_775_808i64

Source§

const MAX: i64 = 9_223_372_036_854_775_807i64

Source§

impl RangePattern for i128

Source§

const MIN: i128 = -170_141_183_460_469_231_731_687_303_715_884_105_728i128

Source§

const MAX: i128 = 170_141_183_460_469_231_731_687_303_715_884_105_727i128

Source§

impl RangePattern for isize

Source§

const MIN: isize = -9_223_372_036_854_775_808isize

Source§

const MAX: isize = 9_223_372_036_854_775_807isize

Source§

impl RangePattern for u8

Source§

const MIN: u8 = 0u8

Source§

const MAX: u8 = 255u8

Source§

impl RangePattern for u16

Source§

const MIN: u16 = 0u16

Source§

const MAX: u16 = 65_535u16

Source§

impl RangePattern for u32

Source§

const MIN: u32 = 0u32

Source§

const MAX: u32 = 4_294_967_295u32

Source§

impl RangePattern for u64

Source§

const MIN: u64 = 0u64

Source§

const MAX: u64 = 18_446_744_073_709_551_615u64

Source§

impl RangePattern for u128

Source§

const MIN: u128 = 0u128

Source§

const MAX: u128 = 340_282_366_920_938_463_463_374_607_431_768_211_455u128

Source§

impl RangePattern for usize

Source§

const MIN: usize = 0usize

Source§

const MAX: usize = 18_446_744_073_709_551_615usize