Skip to main content

Ranged

Trait Ranged 

Source
pub trait Ranged {
    type BoundType: Ord + Copy;

    // Required method
    fn range(&self) -> (Self::BoundType, Self::BoundType);

    // Provided methods
    fn overlap(&self, other: &Self) -> bool { ... }
    fn overlap_inclusive(&self, other: &Self) -> bool { ... }
}
Expand description

Trait for any items with specific range (both boundaries are inclusive).

Required Associated Types§

Required Methods§

Source

fn range(&self) -> (Self::BoundType, Self::BoundType)

Returns the inclusive range of item.

Provided Methods§

Source

fn overlap(&self, other: &Self) -> bool

Source

fn overlap_inclusive(&self, other: &Self) -> bool

Like overlap, but treats touching boundaries as overlapping (inclusive). Used by find_overlapping_items where shared boundaries count as overlap.

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§