pub trait Contain<T> {
// Required method
fn contains(&self, other: &T) -> bool;
}Expand description
The trait Contain<T> defines a method contains that checks if an object of type T is
contained within another object. The contains method takes a reference to another object of type
T as a parameter and returns a boolean value indicating whether the object is contained within the
other object or not. This trait can be implemented for any type that needs to support the contains
functionality.
Required Methods§
Implementations on Foreign Types§
Source§impl Contain<i32> for i32
Checks if the current i32 value is equal to the provided i32 value.
impl Contain<i32> for i32
Checks if the current i32 value is equal to the provided i32 value.
This implementation of the Contain trait for i32 simply compares the two values for equality.
§Examples
use your_crate::generic::Overlap;
let a: i32 = 42; let b: i32 = 42; assert!(a.contains(&b));
Source§fn contains(&self, other: &i32) -> bool
fn contains(&self, other: &i32) -> bool
The function checks if a given value is equal to another value.
Arguments:
other: Theotherparameter in thecontainsfunction is a reference to ani32value that is being compared withself.
Returns:
The contains function is returning a boolean value indicating whether the value of self is
equal to the value of the reference other.
Implementors§
impl<T1, T2, U1, U2> Contain<Point<U1, U2>> for Point<T1, T2>
Checks if a Point<T1, T2> contains a Point<U1, U2>.
This implementation checks if the xcoord and ycoord fields of the Point<T1, T2>
contain the corresponding fields of the Point<U1, U2>. The T1 and T2 types
must implement the Contain trait for U1 and U2 respectively.
impl<T: PartialOrd> Contain<Interval<T>> for Interval<T>
The impl<T: PartialOrd> Contain<Interval<T>> for Interval<T> block is implementing the Contain
trait for the Interval<T> struct.
impl<T: PartialOrd> Contain<Interval<T>> for T
impl<T: PartialOrd> Contain<T> for Interval<T>
The impl<T: PartialOrd> Contain<T> for Interval<T> block is implementing the Contain trait for
the Interval<T> struct.