Trait Contain

Source
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§

Source

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

Implementations on Foreign Types§

Source§

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

The function checks if a given value is equal to another value.

Arguments:

  • other: The other parameter in the contains function is a reference to an i32 value that is being compared with self.

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§

Source§

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

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.

Source§

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.

Source§

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

Source§

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.