Skip to main content

RangeBoundsExt

Trait RangeBoundsExt 

Source
pub trait RangeBoundsExt<T: PartialOrd<T> + Add<Output = T> + Sub<Output = T> + Clone + Copy + Send + Sync + 'static + ZeroOne>: RangeBounds<T> {
    // Provided methods
    fn start(&self) -> Option<T> { ... }
    fn end(&self) -> Option<T> { ... }
    fn start_with_bound(&self, bound: T) -> T { ... }
    fn end_with_bound(&self, bound: T) -> T { ... }
    fn bounds(&self, range: Range<T>) -> Range<T> { ... }
    fn size(&self) -> Option<T> { ... }
    fn is_empty(&self) -> bool { ... }
    fn is_full(&self) -> bool { ... }
    fn map<F, R>(&self, f: F) -> (Bound<R>, Bound<R>)
       where F: Fn(&T) -> R { ... }
}
Expand description

The range extensions.

Provided Methods§

Source

fn start(&self) -> Option<T>

Get the start bound of the range.

Source

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

Get the end bound of the range.

Source

fn start_with_bound(&self, bound: T) -> T

Get the start bound with a default value of the range.

Source

fn end_with_bound(&self, bound: T) -> T

Get the end bound with a default value of the range.

Source

fn bounds(&self, range: Range<T>) -> Range<T>

Get the new range with the given range bounds.

Source

fn size(&self) -> Option<T>

Get the range size.

Source

fn is_empty(&self) -> bool

Check if the range is empty.

Source

fn is_full(&self) -> bool

Check is the range is a full range.

Source

fn map<F, R>(&self, f: F) -> (Bound<R>, Bound<R>)
where F: Fn(&T) -> R,

Map the range with the given method.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T: PartialOrd<T> + Add<Output = T> + Sub<Output = T> + Clone + Copy + Send + Sync + 'static + ZeroOne, RB: RangeBounds<T>> RangeBoundsExt<T> for RB