Skip to main content

RangeInclusiveExt

Trait RangeInclusiveExt 

Source
pub trait RangeInclusiveExt<Idx> {
    // Required methods
    fn checked_len(&self) -> Option<Idx>;
    fn saturating_len(&self) -> Idx;
}
Expand description

A trait defining helper methods for RangeInclusive (start..=end)

Required Methods§

Source

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

Computes the length of the RangeInclusive, checking for underflow and overflow.

Source

fn saturating_len(&self) -> Idx

Computes the length of the RangeInclusive, saturating in case of underflow or overflow.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementations on Foreign Types§

Source§

impl<Idx> RangeInclusiveExt<Idx> for RangeInclusive<Idx>

Source§

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

Source§

fn saturating_len(&self) -> Idx

Implementors§