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.
§Examples
use physdes::generic::Overlap;
let a: i32 = 42;
let b: i32 = 42;
assert!(a.overlaps(&b));
let a: i32 = 42;
let b: i32 = 24;
assert!(!a.overlaps(&b));Required Methods§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl Overlap<i32> for i32
Checks if two i32 values are equal.
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 physdes::generic::Overlap;
let a: i32 = 42;
let b: i32 = 42;
assert!(a.overlaps(&b));
let a: i32 = 42;
let b: i32 = 24;
assert!(!a.overlaps(&b));Source§fn overlaps(&self, other: &i32) -> bool
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: Theotherparameter in theoverlapsfunction is a reference to ani32value.
Returns:
The overlaps function is returning a boolean value indicating whether the value of self is
equal to the value of other.
Implementors§
impl<T1, T2, U1, U2> Overlap<Point<U1, U2>> for Point<T1, T2>
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.