Hull

Trait Hull 

Source
pub trait Hull<RHS = Self> {
    type Output;

    // Required method
    fn hull(&self, rhs: &RHS) -> Self::Output;
}
Expand description

Calculates a new range covering both ranges.

Required Associated Types§

Required Methods§

Source

fn hull(&self, rhs: &RHS) -> Self::Output

Implementations on Foreign Types§

Source§

impl Hull<Interval<i8>> for i8

Source§

fn hull(&self, other: &Interval<i8>) -> Interval<i8>

Calculates the smallest interval containing an interval and a value.

assert_eq!((3 as i8).hull(&Interval::new(5, 8)), Interval::new(3, 8));
assert_eq!((2 as i8).hull(&Interval::new(1, 3)), Interval::new(1, 3));
assert_eq!((9 as i8).hull(&Interval::new(2, 6)), Interval::new(2, 9));
assert_eq!((4 as i8).hull(&Interval::singleton(4)), Interval::singleton(4));
assert_eq!((5 as i8).hull(&Interval::empty()), Interval::singleton(5));
Source§

type Output = Interval<i8>

Source§

impl Hull<Interval<i16>> for i16

Source§

fn hull(&self, other: &Interval<i16>) -> Interval<i16>

Calculates the smallest interval containing an interval and a value.

assert_eq!((3 as i16).hull(&Interval::new(5, 8)), Interval::new(3, 8));
assert_eq!((2 as i16).hull(&Interval::new(1, 3)), Interval::new(1, 3));
assert_eq!((9 as i16).hull(&Interval::new(2, 6)), Interval::new(2, 9));
assert_eq!((4 as i16).hull(&Interval::singleton(4)), Interval::singleton(4));
assert_eq!((5 as i16).hull(&Interval::empty()), Interval::singleton(5));
Source§

type Output = Interval<i16>

Source§

impl Hull<Interval<i32>> for i32

Source§

fn hull(&self, other: &Interval<i32>) -> Interval<i32>

Calculates the smallest interval containing an interval and a value.

assert_eq!((3 as i32).hull(&Interval::new(5, 8)), Interval::new(3, 8));
assert_eq!((2 as i32).hull(&Interval::new(1, 3)), Interval::new(1, 3));
assert_eq!((9 as i32).hull(&Interval::new(2, 6)), Interval::new(2, 9));
assert_eq!((4 as i32).hull(&Interval::singleton(4)), Interval::singleton(4));
assert_eq!((5 as i32).hull(&Interval::empty()), Interval::singleton(5));
Source§

type Output = Interval<i32>

Source§

impl Hull<Interval<i64>> for i64

Source§

fn hull(&self, other: &Interval<i64>) -> Interval<i64>

Calculates the smallest interval containing an interval and a value.

assert_eq!((3 as i64).hull(&Interval::new(5, 8)), Interval::new(3, 8));
assert_eq!((2 as i64).hull(&Interval::new(1, 3)), Interval::new(1, 3));
assert_eq!((9 as i64).hull(&Interval::new(2, 6)), Interval::new(2, 9));
assert_eq!((4 as i64).hull(&Interval::singleton(4)), Interval::singleton(4));
assert_eq!((5 as i64).hull(&Interval::empty()), Interval::singleton(5));
Source§

type Output = Interval<i64>

Source§

impl Hull<Interval<isize>> for isize

Source§

fn hull(&self, other: &Interval<isize>) -> Interval<isize>

Calculates the smallest interval containing an interval and a value.

assert_eq!((3 as isize).hull(&Interval::new(5, 8)), Interval::new(3, 8));
assert_eq!((2 as isize).hull(&Interval::new(1, 3)), Interval::new(1, 3));
assert_eq!((9 as isize).hull(&Interval::new(2, 6)), Interval::new(2, 9));
assert_eq!((4 as isize).hull(&Interval::singleton(4)), Interval::singleton(4));
assert_eq!((5 as isize).hull(&Interval::empty()), Interval::singleton(5));
Source§

type Output = Interval<isize>

Source§

impl Hull<Interval<u8>> for u8

Source§

fn hull(&self, other: &Interval<u8>) -> Interval<u8>

Calculates the smallest interval containing an interval and a value.

assert_eq!((3 as u8).hull(&Interval::new(5, 8)), Interval::new(3, 8));
assert_eq!((2 as u8).hull(&Interval::new(1, 3)), Interval::new(1, 3));
assert_eq!((9 as u8).hull(&Interval::new(2, 6)), Interval::new(2, 9));
assert_eq!((4 as u8).hull(&Interval::singleton(4)), Interval::singleton(4));
assert_eq!((5 as u8).hull(&Interval::empty()), Interval::singleton(5));
Source§

type Output = Interval<u8>

Source§

impl Hull<Interval<u16>> for u16

Source§

fn hull(&self, other: &Interval<u16>) -> Interval<u16>

Calculates the smallest interval containing an interval and a value.

assert_eq!((3 as u16).hull(&Interval::new(5, 8)), Interval::new(3, 8));
assert_eq!((2 as u16).hull(&Interval::new(1, 3)), Interval::new(1, 3));
assert_eq!((9 as u16).hull(&Interval::new(2, 6)), Interval::new(2, 9));
assert_eq!((4 as u16).hull(&Interval::singleton(4)), Interval::singleton(4));
assert_eq!((5 as u16).hull(&Interval::empty()), Interval::singleton(5));
Source§

type Output = Interval<u16>

Source§

impl Hull<Interval<u32>> for u32

Source§

fn hull(&self, other: &Interval<u32>) -> Interval<u32>

Calculates the smallest interval containing an interval and a value.

assert_eq!((3 as u32).hull(&Interval::new(5, 8)), Interval::new(3, 8));
assert_eq!((2 as u32).hull(&Interval::new(1, 3)), Interval::new(1, 3));
assert_eq!((9 as u32).hull(&Interval::new(2, 6)), Interval::new(2, 9));
assert_eq!((4 as u32).hull(&Interval::singleton(4)), Interval::singleton(4));
assert_eq!((5 as u32).hull(&Interval::empty()), Interval::singleton(5));
Source§

type Output = Interval<u32>

Source§

impl Hull<Interval<u64>> for u64

Source§

fn hull(&self, other: &Interval<u64>) -> Interval<u64>

Calculates the smallest interval containing an interval and a value.

assert_eq!((3 as u64).hull(&Interval::new(5, 8)), Interval::new(3, 8));
assert_eq!((2 as u64).hull(&Interval::new(1, 3)), Interval::new(1, 3));
assert_eq!((9 as u64).hull(&Interval::new(2, 6)), Interval::new(2, 9));
assert_eq!((4 as u64).hull(&Interval::singleton(4)), Interval::singleton(4));
assert_eq!((5 as u64).hull(&Interval::empty()), Interval::singleton(5));
Source§

type Output = Interval<u64>

Source§

impl Hull<Interval<usize>> for usize

Source§

fn hull(&self, other: &Interval<usize>) -> Interval<usize>

Calculates the smallest interval containing an interval and a value.

assert_eq!((3 as usize).hull(&Interval::new(5, 8)), Interval::new(3, 8));
assert_eq!((2 as usize).hull(&Interval::new(1, 3)), Interval::new(1, 3));
assert_eq!((9 as usize).hull(&Interval::new(2, 6)), Interval::new(2, 9));
assert_eq!((4 as usize).hull(&Interval::singleton(4)), Interval::singleton(4));
assert_eq!((5 as usize).hull(&Interval::empty()), Interval::singleton(5));
Source§

type Output = Interval<usize>

Implementors§

Source§

impl<Bound> Hull for Interval<Bound>
where Bound: Width + Num,

Source§

type Output = Interval<Bound>

Source§

impl<Bound> Hull<Bound> for Interval<Bound>
where Bound: Width + Num,

Source§

type Output = Interval<Bound>