Trait RangePattern

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

    // Required method
    fn sub_one(self) -> Self;
}
๐Ÿ”ฌThis is a nightly-only experimental API. (pattern_type_range_trait #123646)
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 #123646)

Trait version of the inherent MIN assoc const.

Source

const MAX: Self

๐Ÿ”ฌThis is a nightly-only experimental API. (pattern_type_range_trait #123646)

Trait version of the inherent MIN assoc const.

Required Methodsยง

Source

fn sub_one(self) -> Self

๐Ÿ”ฌThis is a nightly-only experimental API. (pattern_type_range_trait #123646)

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: Self = '\0'

Sourceยง

const MAX: Self = '\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