Trait RangeCheck

Source
pub trait RangeCheck: RangeBounds<usize> + Debug {
    // Required method
    fn is_valid(&self, len: usize) -> bool;
}
Expand description

A range that can check whether it is within the bounds of a slice.

This traits makes it possible to monomorphize the six different range checks that are necessary to handle the six type of ranges available in core::ops.

Required Methods§

Source

fn is_valid(&self, len: usize) -> bool

Returns true if the range is within the bounds of a slice of given length

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.

Implementations on Foreign Types§

Source§

impl RangeCheck for Range<usize>

Source§

fn is_valid(&self, len: usize) -> bool

Source§

impl RangeCheck for RangeFrom<usize>

Source§

fn is_valid(&self, len: usize) -> bool

Source§

impl RangeCheck for RangeFull

Source§

fn is_valid(&self, _len: usize) -> bool

Source§

impl RangeCheck for RangeInclusive<usize>

Source§

fn is_valid(&self, len: usize) -> bool

Source§

impl RangeCheck for RangeTo<usize>

Source§

fn is_valid(&self, len: usize) -> bool

Source§

impl RangeCheck for RangeToInclusive<usize>

Source§

fn is_valid(&self, len: usize) -> bool

Implementors§