PartialRange

Trait PartialRange 

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

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

Required Methods§

Source

fn start(&self) -> Idx

Source

fn end(&self) -> Option<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>) -> OpenRange<Idx>

Source

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

Source

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

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 + Zero> PartialRange<Idx> for RangeFull

Source§

fn start(&self) -> Idx

Source§

fn end(&self) -> Option<Idx>

Source§

impl<Idx: Clone + Ord> PartialRange<Idx> for Range<Idx>

Source§

fn start(&self) -> Idx

Source§

fn end(&self) -> Option<Idx>

Source§

impl<Idx: Clone + Ord> PartialRange<Idx> for RangeFrom<Idx>

Source§

fn start(&self) -> Idx

Source§

fn end(&self) -> Option<Idx>

Source§

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

Source§

fn start(&self) -> Idx

Source§

fn end(&self) -> Option<Idx>

Source§

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

Source§

fn start(&self) -> Idx

Source§

fn end(&self) -> Option<Idx>

Source§

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

Source§

fn start(&self) -> Idx

Source§

fn end(&self) -> Option<Idx>

Source§

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

Source§

fn start(&self) -> Idx

Source§

fn end(&self) -> Option<Idx>

Implementors§

Source§

impl<Idx: Clone + Ord> PartialRange<Idx> for OpenRange<Idx>