use rustdoc_copy::prelude::*;
use crate::conv::*;
use crate::parts::*;
use crate::*;
use core::borrow::Borrow;
use core::cmp::Ordering;
use core::marker::PhantomData;
use core::ops::{Add, Bound, Range, RangeBounds, Sub};
#[derive(Debug)]
pub struct RangeView<'a, R, T>(
pub &'a R,
PhantomData<T>,
)
where
T: ?Sized,
R: ?Sized + RangeBounds<T>;
impl<'a, R, T> RangeView<'a, R, T>
where
T: ?Sized,
R: ?Sized + RangeBounds<T>,
{
pub fn new(base: &'a R) -> Self {
Self(base, PhantomData)
}
pub fn to_univ(&self) -> RangeUniv<T>
where
T: Clone,
{
let s = self.0.start_bound().cloned();
let e = self.0.end_bound().cloned();
RangeUniv::new(s, e)
}
}
impl<'a, R, T> RangeView<'a, R, T>
where
R: ?Sized + RangeBounds<T>,
T: ?Sized,
{
#[inline]
#[must_use]
pub fn contains<U>(&self, value: &U) -> bool
where
T: PartialOrd<U>,
U: ?Sized + PartialOrd<T>,
{
RangeBounds::contains(self, value)
}
}
impl<'a, R, T> RangeView<'a, R, T>
where
R: ?Sized + RangeBounds<T>,
T: ?Sized,
{
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::is_empty::top!()]
#[doc = doc_rrb::side::is_empty::sub::examples::head!()]
pub fn is_empty(&self) -> bool
where
T: PartialOrd,
{
RichRangeBounds::is_empty(self)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::is_broken::top!()]
#[doc = doc_rrb::side::is_broken::sub::examples::head!()]
pub fn is_broken(&self) -> bool
where
T: PartialOrd,
{
RichRangeBounds::is_broken(self)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::is_cursor::top!()]
#[doc = doc_rrb::side::is_cursor::sub::examples::head!()]
pub fn is_cursor(&self) -> bool
where
T: PartialEq,
{
RichRangeBounds::is_cursor(self)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::is_cursor_fwd::top!()]
#[doc = doc_rrb::side::is_cursor_fwd::sub::examples::head!()]
pub fn is_cursor_fwd(&self) -> bool
where
T: PartialEq,
{
RichRangeBounds::is_cursor_fwd(self)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::is_cursor_bwd::top!()]
#[doc = doc_rrb::side::is_cursor_bwd::sub::examples::head!()]
pub fn is_cursor_bwd(&self) -> bool
where
T: PartialEq,
{
RichRangeBounds::is_cursor_bwd(self)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::is_point::top!()]
#[doc = doc_rrb::side::is_point::sub::examples::head!()]
pub fn is_point(&self) -> bool
where
T: PartialEq,
{
RichRangeBounds::is_point(self)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::is_wide::top!()]
#[doc = doc_rrb::side::is_wide::sub::examples::head!()]
pub fn is_wide(&self) -> bool
where
T: PartialOrd,
{
RichRangeBounds::is_wide(self)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::is_full::top!()]
#[doc = doc_rrb::side::is_full::sub::examples::head!()]
pub fn is_full(&self) -> bool
where
T: PartialOrd,
{
RichRangeBounds::is_full(self)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::start_edge::top!()]
#[doc = doc_rrb::side::start_edge::sub::examples::head!()]
pub fn start_edge(&self) -> Edge<&T> {
RichRangeBounds::start_edge(self)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::end_edge::top!()]
#[doc = doc_rrb::side::end_edge::sub::examples::head!()]
pub fn end_edge(&self) -> Edge<&T> {
RichRangeBounds::end_edge(self)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::head::top!()]
#[doc = doc_rrb::side::head::sub::panics::all!()]
#[doc = doc_rrb::side::head::sub::examples::head!()]
pub fn head(&self) -> T
where
T: Clone + HasLimits + HasNexts,
{
RichRangeBounds::head(self)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::tail::top!()]
#[doc = doc_rrb::side::tail::sub::panics::all!()]
#[doc = doc_rrb::side::tail::sub::examples::head!()]
pub fn tail(&self) -> T
where
T: Clone + HasLimits + HasNexts,
{
RichRangeBounds::tail(self)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::prev::top!()]
#[doc = doc_rrb::side::prev::sub::panics::all!()]
#[doc = doc_rrb::side::prev::sub::examples::head!()]
pub fn prev(&self) -> T
where
T: Clone + HasLimits + HasNexts,
{
RichRangeBounds::prev(self)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::next::top!()]
#[doc = doc_rrb::side::next::sub::panics::all!()]
#[doc = doc_rrb::side::next::sub::examples::head!()]
pub fn next(&self) -> T
where
T: Clone + HasLimits + HasNexts,
{
RichRangeBounds::next(self)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::cursor::top!()]
#[doc = doc_rrb::side::cursor::sub::examples::head!()]
pub fn cursor(&self) -> Option<&T>
where
T: PartialEq,
{
RichRangeBounds::cursor(self)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::point::top!()]
#[doc = doc_rrb::side::point::sub::examples::head!()]
pub fn point(&self) -> Option<&T>
where
T: PartialEq,
{
RichRangeBounds::point(self)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::len::top!()]
#[doc = doc_rrb::side::len::sub::groups::all!()]
#[doc = doc_rrb::side::len::sub::examples::head!()]
pub fn len(&self) -> Option<usize>
where
T: Step,
{
RichRangeBounds::len(self)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::size::top!()]
#[doc = doc_rrb::side::size::sub::panics::all!()]
#[doc = doc_rrb::side::size::sub::groups::all!()]
#[doc = doc_rrb::side::size::sub::examples::head!()]
pub fn size(&self) -> Option<T>
where
T: Step,
for<'x> &'x T: Sub<&'x T, Output = T>,
{
RichRangeBounds::size(self)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::width::top!()]
#[doc = doc_rrb::side::width::sub::notes::all!()]
#[doc = doc_rrb::side::width::sub::panics::all!()]
#[doc = doc_rrb::side::width::sub::groups::all!()]
#[doc = doc_rrb::side::width::sub::examples::head!()]
pub fn width(&self) -> Option<T>
where
T: Sized + PartialOrd,
for<'x> &'x T: Sub<&'x T, Output = T>,
{
RichRangeBounds::width(self)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::bounds::top!()]
#[doc = doc_rrb::side::bounds::sub::examples::head!()]
pub fn bounds(&self) -> (Bound<&T>, Bound<&T>) {
RichRangeBounds::bounds(self)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::edges::top!()]
#[doc = doc_rrb::side::edges::sub::examples::head!()]
pub fn edges(&self) -> (Edge<&T>, Edge<&T>) {
RichRangeBounds::edges(self)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::as_ref::top!()]
#[doc = doc_rrb::side::as_ref::sub::examples::head!()]
pub fn as_ref(&self) -> <Self as RangeSrc<T>>::Range<&T>
where
T: Sized,
Self: RangeSrc<T>,
{
RichRangeBounds::as_ref(self)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::cast::top!()]
#[doc = doc_rrb::side::cast::sub::examples::head!()]
pub fn cast<U>(self) -> <Self as RangeSrc<T>>::Range<U>
where
T: Sized,
U: From<T>,
Self: RangeSrc<T> + RangeParts<T>,
{
RichRangeBounds::cast(self)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::try_cast::top!()]
#[doc = doc_rrb::side::try_cast::sub::examples::head!()]
pub fn try_cast<U>(self) -> Option<<Self as RangeSrc<T>>::Range<U>>
where
T: Sized,
U: TryFrom<T>,
Self: RangeSrc<T> + RangeParts<T>,
{
RichRangeBounds::try_cast(self)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::to_range::top!()]
#[doc = doc_rrb::side::to_range::sub::panics::all!()]
#[doc = doc_rrb::side::to_range::sub::examples::head!()]
pub fn to_range(&self) -> Range<T>
where
T: Clone,
T: HasLimits + HasNexts,
{
RichRangeBounds::to_range(self)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::into_option::top!()]
#[doc = doc_rrb::side::into_option::sub::examples::head!()]
pub fn into_option(self) -> Option<Self>
where
Self: Sized,
T: PartialOrd,
{
RichRangeBounds::into_option(self)
}
#[inline]
#[doc_on_only]
#[doc = doc_rrb::side::iter::top!()]
#[doc = doc_rrb::side::iter::sub::examples::head!()]
pub fn iter(&self) -> IterRichRange<T>
where
T: Step,
{
RichRangeBounds::iter(self)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::flip::top!()]
#[doc = doc_rrb::side::flip::sub::notes::all!()]
#[doc = doc_rrb::side::flip::sub::examples::head!()]
pub fn flip(&self) -> (Option<RangeUniv<T>>, Option<RangeUniv<T>>)
where
T: Clone + PartialOrd,
{
RichRangeBounds::flip(self)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::flip_adv::top!()]
#[doc = doc_rrb::side::flip_adv::sub::notes::all!()]
#[doc = doc_rrb::side::flip_adv::sub::examples::head!()]
pub fn flip_adv(&self, mode: CursorMode) -> (Option<RangeUniv<T>>, Option<RangeUniv<T>>)
where
T: Clone + PartialOrd,
{
RichRangeBounds::flip_adv(self, mode)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::shl::top!()]
#[doc = doc_rrb::side::shl::sub::panics::all!()]
#[doc = doc_rrb::side::shl::sub::examples::head!()]
pub fn shl(&self, value: impl Borrow<T>) -> RangeUniv<T>
where
T: Sized,
for<'x> &'x T: Sub<&'x T, Output = T>,
{
RichRangeBounds::shl(self, value)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::shr::top!()]
#[doc = doc_rrb::side::shr::sub::panics::all!()]
#[doc = doc_rrb::side::shr::sub::examples::head!()]
pub fn shr(&self, value: impl Borrow<T>) -> RangeUniv<T>
where
T: Sized,
for<'x> &'x T: Add<&'x T, Output = T>,
{
RichRangeBounds::shr(self, value)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::add_start::top!()]
#[doc = doc_rrb::side::add_start::sub::panics::all!()]
#[doc = doc_rrb::side::add_start::sub::examples::head!()]
pub fn add_start(&self, value: impl Borrow<T>) -> RangeUniv<T>
where
T: Clone,
for<'x> &'x T: Add<&'x T, Output = T>,
{
RichRangeBounds::add_start(self, value)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::add_end::top!()]
#[doc = doc_rrb::side::add_end::sub::panics::all!()]
#[doc = doc_rrb::side::add_end::sub::examples::head!()]
pub fn add_end(&self, value: impl Borrow<T>) -> RangeUniv<T>
where
T: Clone,
for<'x> &'x T: Add<&'x T, Output = T>,
{
RichRangeBounds::add_end(self, value)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::sub_start::top!()]
#[doc = doc_rrb::side::sub_start::sub::panics::all!()]
#[doc = doc_rrb::side::sub_start::sub::examples::head!()]
pub fn sub_start(&self, value: impl Borrow<T>) -> RangeUniv<T>
where
T: Clone,
for<'x> &'x T: Sub<&'x T, Output = T>,
{
RichRangeBounds::sub_start(self, value)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::sub_end::top!()]
#[doc = doc_rrb::side::sub_end::sub::panics::all!()]
#[doc = doc_rrb::side::sub_end::sub::examples::head!()]
pub fn sub_end(&self, value: impl Borrow<T>) -> RangeUniv<T>
where
T: Clone,
for<'x> &'x T: Sub<&'x T, Output = T>,
{
RichRangeBounds::sub_end(self, value)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::calc_start::top!()]
#[doc = doc_rrb::side::calc_start::sub::panics::all!()]
#[doc = doc_rrb::side::calc_start::sub::examples::head!()]
pub fn calc_start(&self, width: impl Borrow<T>) -> RangeUniv<T>
where
T: Clone,
for<'x> &'x T: Sub<&'x T, Output = T>,
{
RichRangeBounds::calc_start(self, width)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::calc_end::top!()]
#[doc = doc_rrb::side::calc_end::sub::panics::all!()]
#[doc = doc_rrb::side::calc_end::sub::examples::head!()]
pub fn calc_end(&self, width: impl Borrow<T>) -> RangeUniv<T>
where
T: Clone,
for<'x> &'x T: Add<&'x T, Output = T>,
{
RichRangeBounds::calc_end(self, width)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::align_start::top!()]
#[doc = doc_rrb::side::align_start::sub::panics::all!()]
#[doc = doc_rrb::side::align_start::sub::examples::head!()]
pub fn align_start(&self, value: impl Borrow<T>) -> RangeUniv<T>
where
T: Clone + PartialOrd,
for<'x> &'x T: CheckedAdd<&'x T, Output = T>,
for<'x> &'x T: CheckedSub<&'x T, Output = T>,
{
RichRangeBounds::align_start(self, value)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::align_end::top!()]
#[doc = doc_rrb::side::align_end::sub::panics::all!()]
#[doc = doc_rrb::side::align_end::sub::examples::head!()]
pub fn align_end(&self, value: impl Borrow<T>) -> RangeUniv<T>
where
T: Clone + PartialOrd,
for<'x> &'x T: CheckedAdd<&'x T, Output = T>,
for<'x> &'x T: CheckedSub<&'x T, Output = T>,
{
RichRangeBounds::align_end(self, value)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::map::top!()]
#[doc = doc_rrb::side::map::sub::examples::head!()]
pub fn map<F, U>(self, f: F) -> RangeUniv<U>
where
T: Clone,
F: FnMut(T) -> U,
{
RichRangeBounds::map(self, f)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::try_map::top!()]
#[doc = doc_rrb::side::try_map::sub::examples::head!()]
pub fn try_map<F, U>(self, f: F) -> Option<RangeUniv<U>>
where
T: Clone,
F: FnMut(T) -> Option<U>,
{
RichRangeBounds::try_map(self, f)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::checked_shl::top!()]
#[doc = doc_rrb::side::checked_shl::sub::examples::head!()]
pub fn checked_shl(&self, value: impl Borrow<T>) -> Option<RangeUniv<T>>
where
T: Sized,
for<'x> &'x T: CheckedSub<&'x T, Output = T>,
{
RichRangeBounds::checked_shl(self, value)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::checked_shr::top!()]
#[doc = doc_rrb::side::checked_shr::sub::examples::head!()]
pub fn checked_shr(&self, value: impl Borrow<T>) -> Option<RangeUniv<T>>
where
T: Sized,
for<'x> &'x T: CheckedAdd<&'x T, Output = T>,
{
RichRangeBounds::checked_shr(self, value)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::checked_add_start::top!()]
#[doc = doc_rrb::side::checked_add_start::sub::examples::head!()]
pub fn checked_add_start(&self, value: impl Borrow<T>) -> Option<RangeUniv<T>>
where
T: Clone,
for<'x> &'x T: CheckedAdd<&'x T, Output = T>,
{
RichRangeBounds::checked_add_start(self, value)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::checked_add_end::top!()]
#[doc = doc_rrb::side::checked_add_end::sub::examples::head!()]
pub fn checked_add_end(&self, value: impl Borrow<T>) -> Option<RangeUniv<T>>
where
T: Clone,
for<'x> &'x T: CheckedAdd<&'x T, Output = T>,
{
RichRangeBounds::checked_add_end(self, value)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::checked_sub_start::top!()]
#[doc = doc_rrb::side::checked_sub_start::sub::examples::head!()]
pub fn checked_sub_start(&self, value: impl Borrow<T>) -> Option<RangeUniv<T>>
where
T: Clone,
for<'x> &'x T: CheckedSub<&'x T, Output = T>,
{
RichRangeBounds::checked_sub_start(self, value)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::checked_sub_end::top!()]
#[doc = doc_rrb::side::checked_sub_end::sub::examples::head!()]
pub fn checked_sub_end(&self, value: impl Borrow<T>) -> Option<RangeUniv<T>>
where
T: Clone,
for<'x> &'x T: CheckedSub<&'x T, Output = T>,
{
RichRangeBounds::checked_sub_end(self, value)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::checked_calc_start::top!()]
#[doc = doc_rrb::side::checked_calc_start::sub::panics::all!()]
#[doc = doc_rrb::side::checked_calc_start::sub::examples::head!()]
pub fn checked_calc_start(&self, width: impl Borrow<T>) -> Option<RangeUniv<T>>
where
T: Clone,
for<'x> &'x T: CheckedSub<&'x T, Output = T>,
{
RichRangeBounds::checked_calc_start(self, width)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::checked_calc_end::top!()]
#[doc = doc_rrb::side::checked_calc_end::sub::panics::all!()]
#[doc = doc_rrb::side::checked_calc_end::sub::examples::head!()]
pub fn checked_calc_end(&self, width: impl Borrow<T>) -> Option<RangeUniv<T>>
where
T: Clone,
for<'x> &'x T: CheckedAdd<&'x T, Output = T>,
{
RichRangeBounds::checked_calc_end(self, width)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::checked_align_start::top!()]
#[doc = doc_rrb::side::checked_align_start::sub::panics::all!()]
#[doc = doc_rrb::side::checked_align_start::sub::examples::head!()]
pub fn checked_align_start(&self, value: impl Borrow<T>) -> Option<<Self as RangeSrc<T>>::Range<T>>
where
T: Clone + PartialOrd,
Self: RangeSrc<T>,
for<'x> &'x T: CheckedAdd<&'x T, Output = T>,
for<'x> &'x T: CheckedSub<&'x T, Output = T>,
{
RichRangeBounds::checked_align_start(self, value)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::checked_align_end::top!()]
#[doc = doc_rrb::side::checked_align_end::sub::panics::all!()]
#[doc = doc_rrb::side::checked_align_end::sub::examples::head!()]
pub fn checked_align_end(&self, value: impl Borrow<T>) -> Option<<Self as RangeSrc<T>>::Range<T>>
where
T: Clone + PartialOrd,
Self: RangeSrc<T>,
for<'x> &'x T: CheckedAdd<&'x T, Output = T>,
for<'x> &'x T: CheckedSub<&'x T, Output = T>,
{
RichRangeBounds::checked_align_end(self, value)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::equiv::top!()]
#[doc = doc_rrb::side::equiv::sub::examples::head!()]
pub fn equiv<R2>(&self, other: &R2) -> bool
where
R2: ?Sized + RangeBounds<T>,
T: PartialOrd,
{
RichRangeBounds::equiv(self, other)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::intersects::top!()]
#[doc = doc_rrb::side::intersects::sub::notes::all!()]
#[doc = doc_rrb::side::intersects::sub::examples::head!()]
pub fn intersects<R2>(&self, other: &R2) -> bool
where
R2: ?Sized + RangeBounds<T>,
T: PartialOrd,
{
RichRangeBounds::intersects(self, other)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::includes::top!()]
#[doc = doc_rrb::side::includes::sub::notes::all!()]
#[doc = doc_rrb::side::includes::sub::examples::head!()]
pub fn includes<R2>(&self, other: &R2) -> bool
where
R2: ?Sized + RangeBounds<T>,
T: PartialOrd,
{
RichRangeBounds::includes(self, other)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::included::top!()]
#[doc = doc_rrb::side::included::sub::notes::all!()]
#[doc = doc_rrb::side::included::sub::examples::head!()]
pub fn included<R2>(&self, other: &R2) -> bool
where
R2: ?Sized + RangeBounds<T>,
T: PartialOrd,
{
RichRangeBounds::included(self, other)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::adjoins::top!()]
#[doc = doc_rrb::side::adjoins::sub::notes::all!()]
#[doc = doc_rrb::side::adjoins::sub::groups::all!()]
#[doc = doc_rrb::side::adjoins::sub::examples::head!()]
pub fn adjoins<R2>(&self, other: &R2) -> bool
where
R2: ?Sized + RangeBounds<T>,
T: PartialOrd,
{
RichRangeBounds::adjoins(self, other)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::adjoins_prev::top!()]
#[doc = doc_rrb::side::adjoins_prev::sub::notes::all!()]
#[doc = doc_rrb::side::adjoins_prev::sub::groups::all!()]
#[doc = doc_rrb::side::adjoins_prev::sub::examples::head!()]
pub fn adjoins_prev<R2>(&self, other: &R2) -> bool
where
R2: ?Sized + RangeBounds<T>,
T: PartialOrd,
{
RichRangeBounds::adjoins_prev(self, other)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::adjoins_next::top!()]
#[doc = doc_rrb::side::adjoins_next::sub::notes::all!()]
#[doc = doc_rrb::side::adjoins_next::sub::groups::all!()]
#[doc = doc_rrb::side::adjoins_next::sub::examples::head!()]
pub fn adjoins_next<R2>(&self, other: &R2) -> bool
where
R2: ?Sized + RangeBounds<T>,
T: PartialOrd,
{
RichRangeBounds::adjoins_next(self, other)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::touches::top!()]
#[doc = doc_rrb::side::touches::sub::notes::all!()]
#[doc = doc_rrb::side::touches::sub::groups::all!()]
#[doc = doc_rrb::side::touches::sub::examples::head!()]
pub fn touches<R2>(&self, other: &R2) -> bool
where
R2: ?Sized + RangeBounds<T>,
T: PartialOrd,
{
RichRangeBounds::touches(self, other)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::touches_prev::top!()]
#[doc = doc_rrb::side::touches_prev::sub::notes::all!()]
#[doc = doc_rrb::side::touches_prev::sub::groups::all!()]
#[doc = doc_rrb::side::touches_prev::sub::examples::head!()]
pub fn touches_prev<R2>(&self, other: &R2) -> bool
where
R2: ?Sized + RangeBounds<T>,
T: PartialOrd,
{
RichRangeBounds::touches_prev(self, other)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::touches_next::top!()]
#[doc = doc_rrb::side::touches_next::sub::notes::all!()]
#[doc = doc_rrb::side::touches_next::sub::groups::all!()]
#[doc = doc_rrb::side::touches_next::sub::examples::head!()]
pub fn touches_next<R2>(&self, other: &R2) -> bool
where
R2: ?Sized + RangeBounds<T>,
T: PartialOrd,
{
RichRangeBounds::touches_next(self, other)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::rel::top!()]
#[doc = doc_rrb::side::rel::sub::examples::head!()]
pub fn rel<R2>(&self, other: &R2, ps: PosStyle) -> RangeRel
where
R2: ?Sized + RangeBounds<T>,
T: PartialOrd,
{
RichRangeBounds::rel(self, other, ps)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::cut::top!()]
#[doc = doc_rrb::side::cut::sub::notes::all!()]
#[doc = doc_rrb::side::cut::sub::examples::head!()]
pub fn cut(&self, pos: &T, mode: CutMode) -> (Option<RangeUniv<T>>, Option<RangeUniv<T>>)
where
T: Clone + PartialOrd,
{
RichRangeBounds::cut(self, pos, mode)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::interval::top!()]
#[doc = doc_rrb::side::interval::sub::panics::all!()]
#[doc = doc_rrb::side::interval::sub::examples::head!()]
pub fn interval(&self, other: &Self) -> Option<RangeUniv<T>>
where
T: Clone + PartialOrd,
{
RichRangeBounds::interval(self, other)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::interval_adv::top!()]
#[doc = doc_rrb::side::interval_adv::sub::panics::all!()]
#[doc = doc_rrb::side::interval_adv::sub::examples::head!()]
pub fn interval_adv(&self, other: &Self, mode: CursorMode) -> Option<RangeUniv<T>>
where
T: Clone + PartialOrd,
{
RichRangeBounds::interval_adv(self, other, mode)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::prod::top!()]
#[doc = doc_rrb::side::prod::sub::notes::all!()]
#[doc = doc_rrb::side::prod::sub::panics::all!()]
#[doc = doc_rrb::side::prod::sub::examples::head!()]
pub fn prod(&self, other: &Self) -> Option<RangeUniv<T>>
where
T: Clone + PartialOrd,
{
RichRangeBounds::prod(self, other)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::enwrap::top!()]
#[doc = doc_rrb::side::enwrap::sub::notes::all!()]
#[doc = doc_rrb::side::enwrap::sub::panics::all!()]
#[doc = doc_rrb::side::enwrap::sub::examples::head!()]
pub fn enwrap(&self, other: &Self) -> Option<RangeUniv<T>>
where
T: Clone + PartialOrd,
{
RichRangeBounds::enwrap(self, other)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::union::top!()]
#[doc = doc_rrb::side::union::sub::notes::all!()]
#[doc = doc_rrb::side::union::sub::panics::all!()]
#[doc = doc_rrb::side::union::sub::examples::head!()]
pub fn union(&self, other: &Self) -> (RangeUniv<T>, Option<RangeUniv<T>>)
where
T: Clone + PartialOrd,
{
RichRangeBounds::union(self, other)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::diff::top!()]
#[doc = doc_rrb::side::diff::sub::notes::all!()]
#[doc = doc_rrb::side::diff::sub::panics::all!()]
#[doc = doc_rrb::side::diff::sub::examples::head!()]
pub fn diff<R2>(&self, other: &R2) -> (Option<RangeUniv<T>>, Option<RangeUniv<T>>)
where
R2: ?Sized + RangeBounds<T>,
T: Clone + PartialOrd,
{
RichRangeBounds::diff(self, other)
}
#[inline]
#[must_use]
#[doc_on_only]
#[doc = doc_rrb::side::diff_adv::top!()]
#[doc = doc_rrb::side::diff_adv::sub::notes::all!()]
#[doc = doc_rrb::side::diff_adv::sub::panics::all!()]
#[doc = doc_rrb::side::diff_adv::sub::examples::head!()]
pub fn diff_adv<R2>(
&self,
other: &R2,
mode: CursorMode,
) -> (Option<RangeUniv<T>>, Option<RangeUniv<T>>)
where
R2: ?Sized + RangeBounds<T>,
T: Clone + PartialOrd,
{
RichRangeBounds::diff_adv(self, other, mode)
}
}
impl<R, T> RangeBounds<T> for RangeView<'_, R, T>
where
T: ?Sized,
R: ?Sized + RangeBounds<T>,
{
fn start_bound(&self) -> Bound<&T> {
self.0.start_bound()
}
fn end_bound(&self) -> Bound<&T> {
self.0.end_bound()
}
}
impl<R, T> RichRangeBounds<T> for RangeView<'_, R, T>
where
T: ?Sized,
R: ?Sized + RangeBounds<T>,
{
}
impl<R, T> IntoIterator for RangeView<'_, R, T>
where
R: ?Sized + RangeBounds<T>,
T: Step,
{
type Item = T;
type IntoIter = IterRichRange<T>;
fn into_iter(self) -> Self::IntoIter {
let s = self.0.start_bound().cloned();
let e = self.0.end_bound().cloned();
IterRichRange::new(s, e)
}
}
impl<R, T> Clone for RangeView<'_, R, T>
where
T: ?Sized,
R: ?Sized + RangeBounds<T>,
{
fn clone(&self) -> Self {
*self
}
}
impl<R, T> Copy for RangeView<'_, R, T>
where
T: ?Sized,
R: ?Sized + RangeBounds<T>,
{
}
impl<R, T> Eq for RangeView<'_, R, T>
where
R: ?Sized + RangeBounds<T>,
T: Eq,
{
}
impl<R, T> PartialEq for RangeView<'_, R, T>
where
R: ?Sized + RangeBounds<T>,
T: PartialEq,
{
fn eq(&self, other: &Self) -> bool {
calc::is_eq(self, other)
}
}
impl<R, T> PartialOrd for RangeView<'_, R, T>
where
R: ?Sized + RangeBounds<T>,
T: PartialOrd,
{
fn partial_cmp(&self, other: &Self) -> Option<Ordering> {
calc::cmp(self, other)
}
}