Trait Intersect

Source
pub trait Intersect<T: ?Sized> {
    type Output;

    // Required method
    fn intersect_with(&self, other: &T) -> Self::Output;
}
Expand description

The above code is defining a trait in Rust called Intersect. This trait has one associated type Output and one method intersect_with that takes a reference to another object of type T and returns an object of type Output. This trait can be implemented for various types to provide custom intersection behavior.

Required Associated Types§

Required Methods§

Source

fn intersect_with(&self, other: &T) -> Self::Output

Implementations on Foreign Types§

Source§

impl Intersect<i32> for i32

Source§

fn intersect_with(&self, other: &i32) -> Self::Output

The intersect_with function calculates the intersection of two values by finding the maximum lower bound and minimum upper bound.

Arguments:

  • other: The other parameter in the intersect_with function is a reference to an i32 type. This parameter is used to find the intersection between the current instance (self) and the provided i32 value.
Source§

type Output = Interval<i32>

Implementors§

Source§

impl<T1, T2> Intersect<Point<T1, T2>> for Point<T1, T2>
where T1: Intersect<T1>, T2: Intersect<T2>,

The above Rust code is implementing an Intersect trait for the Point struct. The Intersect trait is defined for two generic types T1 and T2, and it requires that T1 and T2 implement the Intersect trait themselves.

Source§

type Output = Point<<T1 as Intersect<T1>>::Output, <T2 as Intersect<T2>>::Output>

Source§

impl<T> Intersect<Interval<T>> for Interval<T>
where T: Copy + Ord,

Source§

impl<T> Intersect<Interval<T>> for T
where T: Copy + Ord,

Source§

impl<T> Intersect<T> for Interval<T>
where T: Copy + Ord,