Trait Overlap

Source
pub trait Overlap<T> {
    // Required method
    fn overlaps(&self, other: &T) -> bool;
}
Expand description

The trait Overlap<T> defines a method overlaps that checks if two objects of type T overlap with each other. The overlaps method takes a reference to another object of type T as a parameter and returns a boolean value indicating whether the two objects overlap or not. This trait can be implemented for any type that needs to support the overlaps functionality.

Required Methods§

Source

fn overlaps(&self, other: &T) -> bool

Implementations on Foreign Types§

Source§

impl Overlap<i32> for i32

Checks if two i32 values are equal.

This implementation of the Overlap trait for i32 simply checks if the two values are equal.

§Examples

use your_crate::generic::Overlap;

let a: i32 = 42; let b: i32 = 42; assert!(a.overlaps(&b));

Source§

fn overlaps(&self, other: &i32) -> bool

The overlaps function in Rust checks if two references to i32 values point to the same memory location.

Arguments:

  • other: The other parameter in the overlaps function is a reference to an i32 value.

Returns:

The overlaps function is returning a boolean value indicating whether the value of self is equal to the value of other.

Implementors§

Source§

impl<T1, T2, U1, U2> Overlap<Point<U1, U2>> for Point<T1, T2>
where T1: Overlap<U1>, T2: Overlap<U2>,

Checks if two Point instances overlap.

This implementation checks if the xcoord and ycoord components of the two Point instances overlap, using the Overlap trait implementation for their respective component types.

§Example

use your_crate::Point;

let p1 = Point::new(1, 2); let p2 = Point::new(2, 3); assert!(p1.overlaps(&p2));

Source§

impl<T: PartialOrd> Overlap<Interval<T>> for Interval<T>

The impl<T: PartialOrd> Overlap<Interval<T>> for Interval<T> block is implementing the Overlap trait for the Interval<T> struct.

Source§

impl<T: PartialOrd> Overlap<Interval<T>> for T

Source§

impl<T: PartialOrd> Overlap<T> for Interval<T>