Range

Trait Range 

Source
pub trait Range<Idx: Clone + Ord = usize> {
    // Required methods
    fn start(&self) -> Idx;
    fn end(&self) -> Idx;

    // Provided methods
    fn clamp(&self, start: impl Into<Idx>, end: impl Into<Idx>) -> Range<Idx> { ... }
    fn clamp_left(&self, start: impl Into<Idx>) -> Range<Idx> { ... }
    fn clamp_right(&self, end: impl Into<Idx>) -> Range<Idx> { ... }
    fn intersection<T, R>(&self, other: R) -> Range<Idx>
       where T: Clone + Ord + Into<Idx>,
             R: Range<T> { ... }
    fn to_open_range(&self) -> OpenRange<Idx> { ... }
}

Required Methods§

Source

fn start(&self) -> Idx

Source

fn end(&self) -> Idx

Provided Methods§

Source

fn clamp(&self, start: impl Into<Idx>, end: impl Into<Idx>) -> Range<Idx>

Source

fn clamp_left(&self, start: impl Into<Idx>) -> Range<Idx>

Source

fn clamp_right(&self, end: impl Into<Idx>) -> Range<Idx>

Source

fn intersection<T, R>(&self, other: R) -> Range<Idx>
where T: Clone + Ord + Into<Idx>, R: Range<T>,

Source

fn to_open_range(&self) -> OpenRange<Idx>

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<Idx: Clone + Ord> Range<Idx> for Range<Idx>

Source§

fn start(&self) -> Idx

Source§

fn end(&self) -> Idx

Source§

impl<Idx: Clone + Ord, T: Range<Idx>> Range<Idx> for &T

Source§

fn start(&self) -> Idx

Source§

fn end(&self) -> Idx

Source§

impl<Idx: Clone + One + Ord + SaturatingAdd + Zero> Range<Idx> for RangeToInclusive<Idx>

Source§

fn start(&self) -> Idx

Source§

fn end(&self) -> Idx

Source§

impl<Idx: Copy + Ord + Zero> Range<Idx> for RangeTo<Idx>

Source§

fn start(&self) -> Idx

Source§

fn end(&self) -> Idx

Source§

impl<Idx: Copy + One + Ord + SaturatingAdd> Range<Idx> for RangeInclusive<Idx>

Source§

fn start(&self) -> Idx

Source§

fn end(&self) -> Idx

Implementors§