Struct Point

Source
pub struct Point<T1, T2> {
    pub xcoord: T1,
    pub ycoord: T2,
}
Expand description

The code defines a generic Point struct with x and y coordinates.

Properties:

  • xcoord: The xcoord property represents the x-coordinate of a point in a two-dimensional space. It is a generic type T, which means it can be any type that implements the necessary traits for the Point struct.
  • ycoord: The ycoord property represents the y-coordinate of a point in a two-dimensional space. It is a generic type T, which means it can be any type that implements the necessary traits for the Point struct.

Fields§

§xcoord: T1

x portion of the Point object

§ycoord: T2

y portion of the Point object

Implementations§

Source§

impl<T1, T2> Point<T1, T2>

Source

pub const fn new(xcoord: T1, ycoord: T2) -> Self

The new function creates a new Point with the given x and y coordinates.

Arguments:

  • xcoord: The xcoord parameter represents the x-coordinate of the point. It is of type T, which means it can be any type that implements the necessary traits for mathematical operations.
  • ycoord: The ycoord parameter represents the y-coordinate of the point. It is used to specify the vertical position of the point in a two-dimensional coordinate system.

Returns:

The new function returns a new instance of the Point struct with the specified xcoord and ycoord values.

§Examples
use physdes::point::Point;
assert_eq!(Point::new(3, 4).xcoord, 3);
assert_eq!(Point::new(3, 4).ycoord, 4);
Source§

impl<T1: Clone, T2: Clone> Point<T1, T2>

Flips the coordinates of the Point struct, swapping the xcoord and ycoord fields.

This is a convenience method that can be used to quickly create a new Point with the xcoord and ycoord fields swapped. It is implemented for Point structs where both the xcoord and ycoord fields implement the Clone trait.

§Examples

use my_crate::Point;

let p = Point { xcoord: 1, ycoord: 2 }; let flipped = p.flip(); assert_eq!(flipped, Point { xcoord: 2, ycoord: 1 });

Source

pub fn flip(&self) -> Point<T2, T1>

Trait Implementations§

Source§

impl<'a, 'b, T1: Clone + Num, T2: Clone + Num> Add<&'b Vector2<T1, T2>> for &'a Point<T1, T2>

Source§

type Output = Point<T1, T2>

The resulting type after applying the + operator.
Source§

fn add(self, other: &Vector2<T1, T2>) -> Self::Output

Performs the + operation. Read more
Source§

impl<'a, T1: Clone + Num, T2: Clone + Num> Add<&'a Vector2<T1, T2>> for Point<T1, T2>

The above code is implementing a trait for a specific type in Rust. The trait being implemented is not explicitly mentioned in the code snippet, but based on the syntax used (impl Trait for Type), it appears to be a custom trait defined elsewhere in the codebase. The code is implementing the trait for a specific type Point<T1, T2>, where T1 and T2 are generic types that must implement the Clone and Num traits.

Source§

fn add(self, other: &Vector2<T1, T2>) -> Self::Output

The function implements a method that performs a specific operation on two Vector2 instances in Rust.

Arguments:

  • other: The other parameter in the code snippet represents a reference to a Vector2 struct with generic types T1 and T2. This parameter is used as the input for the method being called on self.
Source§

type Output = Point<T1, T2>

The resulting type after applying the + operator.
Source§

impl<'a, T1: Clone + Num, T2: Clone + Num> Add<Vector2<T1, T2>> for &'a Point<T1, T2>

Source§

type Output = Point<T1, T2>

The resulting type after applying the + operator.
Source§

fn add(self, other: Vector2<T1, T2>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T1: Clone + Num, T2: Clone + Num> Add<Vector2<T1, T2>> for Point<T1, T2>

Source§

fn add(self, other: Vector2<T1, T2>) -> Self::Output

Translate a new Point

§Examples
use physdes::point::Point;
use physdes::vector2::Vector2;

assert_eq!(Point::new(3, 4) + Vector2::new(5, 3), Point::new(8, 7));
assert_eq!(Point::new(3, 4) + Vector2::new(-5, -3), Point::new(-2, 1));
assert_eq!(Point::new(3, 4) + Vector2::new(5, -3), Point::new(8, 1));
assert_eq!(Point::new(3, 4) + Vector2::new(-5, 3), Point::new(-2, 7));
assert_eq!(Point::new(3, 4) + Vector2::new(0, 0), Point::new(3, 4));
assert_eq!(Point::new(3, 4) + Vector2::new(0, 5), Point::new(3, 9));
Source§

type Output = Point<T1, T2>

The resulting type after applying the + operator.
Source§

impl<'a, T1: Clone + NumAssign, T2: Clone + NumAssign> AddAssign<&'a Vector2<T1, T2>> for Point<T1, T2>

Source§

fn add_assign(&mut self, other: &Vector2<T1, T2>)

Performs the += operation. Read more
Source§

impl<T1: Clone + NumAssign, T2: Clone + NumAssign> AddAssign<Vector2<T1, T2>> for Point<T1, T2>

The above code is implementing the AddAssign trait for a custom type Point<T1, T2>. This implementation allows instances of Point<T1, T2> to be added to instances of Vector2<T1, T2> using the += operator. Inside the add_assign function, the xcoord and ycoord fields of the Point instance are updated by adding the corresponding x_ and y_ fields of the Vector2 instance.

Source§

fn add_assign(&mut self, other: Vector2<T1, T2>)

The add_assign function in Rust adds the x and y coordinates of another Vector2 to the current Vector2.

Arguments:

  • other: The other parameter in the add_assign function is of type Vector2<T1, T2>. It represents another instance of the Vector2 struct with potentially different generic types T1 and T2.
Source§

impl<T1: Clone, T2: Clone> Clone for Point<T1, T2>

Source§

fn clone(&self) -> Point<T1, T2>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
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§

fn contains(&self, other: &Point<U1, U2>) -> bool

The contains function checks if a Point contains another Point by comparing their x and y coordinates.

Arguments:

  • other: The other parameter is a reference to a Point struct with generic types U1 and U2. It represents another point that you want to check for containment within the current Point instance.

Returns:

The contains method is returning a boolean value, which indicates whether the xcoord and ycoord of the current Point instance contain the xcoord and ycoord of the other Point instance respectively.

Source§

impl<T1: Debug, T2: Debug> Debug for Point<T1, T2>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T1: Default, T2: Default> Default for Point<T1, T2>

Source§

fn default() -> Point<T1, T2>

Returns the “default value” for a type. Read more
Source§

impl<T1, T2> Displacement<Point<T1, T2>> for Point<T1, T2>
where T1: Displacement<T1, Output = T1>, T2: Displacement<T2, Output = T2>,

The above Rust code is implementing a Displacement trait for the Point struct. The Displacement trait is generic over two types T1 and T2, and it requires that T1 and T2 implement the Displacement trait with an associated type Output.

Source§

fn displace(&self, other: &Point<T1, T2>) -> Self::Output

The displace function calculates the displacement between two points in Rust.

Arguments:

  • other: The other parameter in the displace method is a reference to another Point object with the same generic types T1 and T2 as the current Point object.
Source§

type Output = Vector2<T1, T2>

Source§

impl<T1: Display, T2: Display> Display for Point<T1, T2>

Implements the Display trait for the Point struct, which allows it to be printed in the format (x, y) where x and y are the coordinates of the point.

This implementation assumes that the xcoord and ycoord fields of the Point struct implement the std::fmt::Display trait, which is enforced by the generic type constraints T1: std::fmt::Display and T2: std::fmt::Display.

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T1: Hash, T2: Hash> Hash for Point<T1, T2>

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

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

The above code is implementing a trait called Hull for the Point struct in Rust. The Hull trait defines a method hull_with that calculates the hull (convex hull, for example) of two points. The implementation specifies that the output type of the hull operation on two Point instances is a new Point with the hull operation applied to the x and y coordinates of the points. The implementation also specifies that the hull operation is applied to the generic types T1 and T2 where T1 and `T

Source§

fn hull_with(&self, other: &Point<T1, T2>) -> Self::Output

The function hull_with calculates the hull with another Point object by combining their x and y coordinates.

Arguments:

  • other: The other parameter in the hull_with method is a reference to another Point struct with the same generic types T1 and T2 as the current Point struct. It is used to combine the coordinates of the current Point with the coordinates
Source§

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

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§

fn intersect_with(&self, other: &Point<T1, T2>) -> Self::Output

The intersect_with function takes another Point as input and returns a new Point with intersected coordinates.

Arguments:

  • other: The other parameter in the intersect_with method is a reference to another Point struct with the same generic types T1 and T2 as the current Point struct. It is used to compare and intersect the xcoord and ycoord
Source§

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

Source§

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

The above Rust code is implementing a trait MinDist for the Point struct. The MinDist trait defines a method min_dist_with that calculates the minimum distance between two points based on the minimum distance between their individual coordinates (xcoord and ycoord). The implementation specifies that the minimum distance between two points is calculated by adding the minimum distances between their respective x and y coordinates.

Source§

fn min_dist_with(&self, other: &Point<U1, U2>) -> u32

The function calculates the minimum distance between two points in a two-dimensional space.

Arguments:

  • other: The other parameter is a reference to a Point struct with generic types U1 and U2.

Returns:

The min_dist_with method is returning the sum of the minimum distances between the x-coordinate of self and the x-coordinate of other, and the y-coordinate of self and the y-coordinate of other.

Source§

impl<T1: Clone + Num + Neg<Output = T1>, T2: Clone + Num + Neg<Output = T2>> Neg for &Point<T1, T2>

The above code is implementing the Neg trait for a reference to a Point<T1, T2> struct in Rust. The Neg trait is used for the negation operation (unary minus) on a value.

Source§

fn neg(self) -> Self::Output

The function neg returns the negation of the cloned value.

Source§

type Output = Point<T1, T2>

The resulting type after applying the - operator.
Source§

impl<T1: Clone + Num + Neg<Output = T1>, T2: Clone + Num + Neg<Output = T2>> Neg for Point<T1, T2>

The above code is implementing the Neg trait for a custom type Point<T1, T2>. This implementation allows for negating instances of the Point type. The Neg trait requires defining an associated type Output and implementing the neg method which returns the negated version of the Point instance by negating its xcoord and ycoord values.

Source§

fn neg(self) -> Self::Output

Negate a Points

§Examples
use physdes::point::Point;

assert_eq!(-Point::new(3, 4), Point::new(-3, -4));
assert_eq!(-Point::new(0, 0), Point::new(0, 0));
Source§

type Output = Point<T1, T2>

The resulting type after applying the - operator.
Source§

impl<T1: Ord, T2: Ord> Ord for Point<T1, T2>

Source§

fn cmp(&self, other: &Point<T1, T2>) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
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§

fn overlaps(&self, other: &Point<U1, U2>) -> bool

The overlaps function checks if two points overlap in both x and y coordinates.

Arguments:

  • other: The other parameter in the overlaps method is a reference to another Point struct with generic types U1 and U2.

Returns:

The overlaps method is returning a boolean value, which indicates whether the x-coordinate of the current Point instance overlaps with the x-coordinate of the other Point instance, and whether the y-coordinate of the current Point instance overlaps with the y-coordinate of the other Point instance. The method returns true if both conditions are met, and

Source§

impl<T1: PartialEq, T2: PartialEq> PartialEq for Point<T1, T2>

Source§

fn eq(&self, other: &Point<T1, T2>) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl<T1: PartialOrd, T2: PartialOrd> PartialOrd for Point<T1, T2>

Source§

fn partial_cmp(&self, other: &Point<T1, T2>) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl<'a, 'b, T1: Clone + Num, T2: Clone + Num> Sub<&'b Point<T1, T2>> for &'a Point<T1, T2>

Source§

type Output = Vector2<T1, T2>

The resulting type after applying the - operator.
Source§

fn sub(self, other: &Point<T1, T2>) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a, T1: Clone + Num, T2: Clone + Num> Sub<&'a Point<T1, T2>> for Point<T1, T2>

Source§

type Output = Vector2<T1, T2>

The resulting type after applying the - operator.
Source§

fn sub(self, other: &Point<T1, T2>) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a, 'b, T1: Clone + Num, T2: Clone + Num> Sub<&'b Vector2<T1, T2>> for &'a Point<T1, T2>

Source§

type Output = Point<T1, T2>

The resulting type after applying the - operator.
Source§

fn sub(self, other: &Vector2<T1, T2>) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a, T1: Clone + Num, T2: Clone + Num> Sub<&'a Vector2<T1, T2>> for Point<T1, T2>

The above code is implementing a trait for a specific type in Rust. The trait being implemented is not explicitly mentioned in the code snippet, but based on the syntax used (impl Trait for Type), it appears to be a custom trait defined elsewhere in the codebase. The code is implementing the trait for a specific type Point<T1, T2>, where T1 and T2 are generic types that must implement the Clone and Num traits.

Source§

fn sub(self, other: &Vector2<T1, T2>) -> Self::Output

The function implements a method that performs a specific operation on two Vector2 instances in Rust.

Arguments:

  • other: The other parameter in the code snippet represents a reference to a Vector2 struct with generic types T1 and T2. This parameter is used as the input for the method being called on self.
Source§

type Output = Point<T1, T2>

The resulting type after applying the - operator.
Source§

impl<'a, T1: Clone + Num, T2: Clone + Num> Sub<Point<T1, T2>> for &'a Point<T1, T2>

Source§

type Output = Vector2<T1, T2>

The resulting type after applying the - operator.
Source§

fn sub(self, other: Point<T1, T2>) -> Self::Output

Performs the - operation. Read more
Source§

impl<'a, T1: Clone + Num, T2: Clone + Num> Sub<Vector2<T1, T2>> for &'a Point<T1, T2>

Source§

type Output = Point<T1, T2>

The resulting type after applying the - operator.
Source§

fn sub(self, other: Vector2<T1, T2>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T1: Clone + Num, T2: Clone + Num> Sub<Vector2<T1, T2>> for Point<T1, T2>

(a, b) - (c, d) == (a - c), (b - d) The above Rust code snippet is implementing the subtraction operation for a Point struct. It defines the implementation of the Sub trait for subtracting a Vector2 from a Point. The code defines the behavior of subtracting a Vector2 from a Point to get a new Point with updated coordinates.

Source§

fn sub(self, other: Vector2<T1, T2>) -> Self::Output

Translate a new Point

§Examples
use physdes::point::Point;
use physdes::vector2::Vector2;
assert_eq!(Point::new(3, 4) - Vector2::new(5, 3), Point::new(-2, 1));
assert_eq!(Point::new(3, 4) - Vector2::new(-5, -3), Point::new(8, 7));
assert_eq!(Point::new(3, 4) - Vector2::new(5, -3), Point::new(-2, 7));
assert_eq!(Point::new(3, 4) - Vector2::new(-5, 3), Point::new(8, 1));
assert_eq!(Point::new(3, 4) - Vector2::new(0, 0), Point::new(3, 4));
assert_eq!(Point::new(3, 4) - Vector2::new(0, 5), Point::new(3, -1));
assert_eq!(Point::new(3, 4) - Vector2::new(5, 0), Point::new(-2, 4));
Source§

type Output = Point<T1, T2>

The resulting type after applying the - operator.
Source§

impl<T1: Clone + Num, T2: Clone + Num> Sub for Point<T1, T2>

The above code is implementing the subtraction operation for a custom Point struct in Rust. It defines the behavior of subtracting one Point from another Point, resulting in a Vector2 representing the displacement between the two points. The sub function takes two Point objects as input and returns a Vector2 object with the x and y coordinates calculated by subtracting the corresponding coordinates of the two points. The code also includes examples demonstrating the usage of the subtraction operation with different scenarios.

Source§

fn sub(self, other: Self) -> Self::Output

Displacement of two Points

Arguments:

  • other: The other parameter is of the same type as self and represents the other object that you want to subtract from self.
§Examples
use physdes::point::Point;
use physdes::vector2::Vector2;

assert_eq!(Point::new(3, 4) - Point::new(5, 3), Vector2::new(-2, 1));
assert_eq!(Point::new(3, 4) - Point::new(-5, -3), Vector2::new(8, 7));
assert_eq!(Point::new(3, 4) - Point::new(5, -3), Vector2::new(-2, 7));
assert_eq!(Point::new(3, 4) - Point::new(-5, 3), Vector2::new(8, 1));
assert_eq!(Point::new(3, 4) - Point::new(0, 0), Vector2::new(3, 4));
Source§

type Output = Vector2<T1, T2>

The resulting type after applying the - operator.
Source§

impl<'a, T1: Clone + NumAssign, T2: Clone + NumAssign> SubAssign<&'a Vector2<T1, T2>> for Point<T1, T2>

Source§

fn sub_assign(&mut self, other: &Vector2<T1, T2>)

Performs the -= operation. Read more
Source§

impl<T1: Clone + NumAssign, T2: Clone + NumAssign> SubAssign<Vector2<T1, T2>> for Point<T1, T2>

The above code is implementing the SubAssign trait for a custom type Point<T1, T2>. This implementation allows instances of Point to be subtracted by instances of Vector2<T1, T2> using the -= operator. Inside the implementation, it subtracts the x_ and y_ components of the other vector from the xcoord and ycoord components of the Point respectively.

Source§

fn sub_assign(&mut self, other: Vector2<T1, T2>)

The function sub_assign subtracts the x_ and y_ components of another Vector2 from the xcoord and ycoord components of the current Vector2.

Arguments:

  • other: The other parameter in the sub_assign function is of type Vector2<T1, T2>. It represents another instance of the Vector2 struct with potentially different generic types T1 and T2. This parameter is used to subtract the `x_
Source§

impl<T1: Copy, T2: Copy> Copy for Point<T1, T2>

Source§

impl<T1: Eq, T2: Eq> Eq for Point<T1, T2>

Source§

impl<T1, T2> StructuralPartialEq for Point<T1, T2>

Auto Trait Implementations§

§

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

§

impl<T1, T2> RefUnwindSafe for Point<T1, T2>

§

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

§

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

§

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

§

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

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

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

Source§

fn contains(&self, _other: &Interval<T>) -> bool

The function contains always returns false and takes a reference to another Interval as input.

Arguments:

  • _other: The _other parameter is a reference to an Interval object of the same type T as the current object.

Returns:

The contains function is returning a boolean value false.

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn hull_with(&self, other: &Interval<T>) -> <T as Hull<Interval<T>>>::Output

The hull_with function in Rust calculates the convex hull of two intervals.

Arguments:

  • other: The other parameter in the hull_with function is a reference to an Interval<T> object.
Source§

type Output = Interval<T>

Source§

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

Source§

fn intersect_with( &self, other: &Interval<T>, ) -> <T as Intersect<Interval<T>>>::Output

The intersect_with function in Rust swaps the receiver and argument before calling the intersect_with method on the argument.

Arguments:

  • other: The other parameter in the intersect_with function represents another Interval<T> that you want to intersect with the current interval.
Source§

type Output = Interval<T>

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

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

Source§

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

The overlaps function in Rust checks if two intervals overlap with each other.

Arguments:

  • other: The other parameter is a reference to an Interval<T> struct, which represents another interval. The Interval<T> struct likely contains two fields, lb and ub, representing the lower and upper bounds of the interval, respectively. The overlaps method is used to

Returns:

The overlaps function is returning a boolean value. It checks if the current interval (self) overlaps with another interval (other) by comparing their lower bounds and upper bounds. If there is any overlap between the two intervals, it returns true, otherwise it returns false.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.