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: Thexcoordproperty represents the x-coordinate of a point in a two-dimensional space. It is a generic typeT, which means it can be any type that implements the necessary traits for thePointstruct.ycoord: Theycoordproperty represents the y-coordinate of a point in a two-dimensional space. It is a generic typeT, which means it can be any type that implements the necessary traits for thePointstruct.
Fields§
§xcoord: T1x portion of the Point object
ycoord: T2y portion of the Point object
Implementations§
Source§impl<T1, T2> Point<T1, T2>
impl<T1, T2> Point<T1, T2>
Sourcepub const fn new(xcoord: T1, ycoord: T2) -> Self
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: Thexcoordparameter represents the x-coordinate of the point. It is of typeT, which means it can be any type that implements the necessary traits for mathematical operations.ycoord: Theycoordparameter 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.
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 });
Trait Implementations§
Source§impl<'a, 'b, T1: Clone + Num, T2: Clone + Num> Add<&'b Vector2<T1, T2>> for &'a Point<T1, T2>
impl<'a, 'b, T1: Clone + Num, T2: Clone + Num> Add<&'b Vector2<T1, T2>> for &'a Point<T1, T2>
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.
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
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: Theotherparameter in the code snippet represents a reference to aVector2struct with generic typesT1andT2. This parameter is used as the input for the method being called onself.
Source§impl<T1: Clone + Num, T2: Clone + Num> Add<Vector2<T1, T2>> for Point<T1, T2>
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
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§impl<'a, T1: Clone + NumAssign, T2: Clone + NumAssign> AddAssign<&'a Vector2<T1, T2>> for Point<T1, T2>
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>)
fn add_assign(&mut self, other: &Vector2<T1, T2>)
+= operation. Read moreSource§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.
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>)
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: Theotherparameter in theadd_assignfunction is of typeVector2<T1, T2>. It represents another instance of theVector2struct with potentially different generic typesT1andT2.
Source§impl<T1, T2, U1, U2> Contain<Point<U1, U2>> for Point<T1, T2>
Checks if a Point<T1, T2> contains a Point<U1, U2>.
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.
Source§fn contains(&self, other: &Point<U1, U2>) -> bool
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: Theotherparameter is a reference to aPointstruct with generic typesU1andU2. It represents another point that you want to check for containment within the currentPointinstance.
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, 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.
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
fn displace(&self, other: &Point<T1, T2>) -> Self::Output
The displace function calculates the displacement between two points in Rust.
Arguments:
other: Theotherparameter in thedisplacemethod is a reference to anotherPointobject with the same generic typesT1andT2as the currentPointobject.
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.
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§impl<T1, T2> Hull<Point<T1, T2>> for Point<T1, 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
impl<T1, T2> Hull<Point<T1, T2>> for Point<T1, 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
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: Theotherparameter in thehull_withmethod is a reference to anotherPointstruct with the same generic typesT1andT2as the currentPointstruct. It is used to combine the coordinates of the currentPointwith the coordinates
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>
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.
impl<T1, T2> Intersect<Point<T1, T2>> for Point<T1, 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
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: Theotherparameter in theintersect_withmethod is a reference to anotherPointstruct with the same generic typesT1andT2as the currentPointstruct. It is used to compare and intersect thexcoordandycoord
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>
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.
impl<T1, T2, U1, U2> MinDist<Point<U1, U2>> for Point<T1, T2>
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
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: Theotherparameter is a reference to aPointstruct with generic typesU1andU2.
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.
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§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.
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§impl<T1: Ord, T2: Ord> Ord for Point<T1, T2>
impl<T1: Ord, T2: Ord> Ord for Point<T1, T2>
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl<T1, T2, U1, U2> Overlap<Point<U1, U2>> for Point<T1, T2>
Checks if two Point instances overlap.
impl<T1, T2, U1, U2> Overlap<Point<U1, U2>> for Point<T1, T2>
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
fn overlaps(&self, other: &Point<U1, U2>) -> bool
The overlaps function checks if two points overlap in both x and y coordinates.
Arguments:
other: Theotherparameter in theoverlapsmethod is a reference to anotherPointstruct with generic typesU1andU2.
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: PartialOrd, T2: PartialOrd> PartialOrd for Point<T1, T2>
impl<T1: PartialOrd, T2: PartialOrd> PartialOrd for Point<T1, T2>
Source§impl<'a, 'b, T1: Clone + Num, T2: Clone + Num> Sub<&'b Vector2<T1, T2>> for &'a Point<T1, T2>
impl<'a, 'b, T1: Clone + Num, T2: Clone + Num> Sub<&'b Vector2<T1, T2>> for &'a Point<T1, T2>
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.
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
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: Theotherparameter in the code snippet represents a reference to aVector2struct with generic typesT1andT2. This parameter is used as the input for the method being called onself.
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.
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
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§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.
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
fn sub(self, other: Self) -> Self::Output
Displacement of two Points
Arguments:
other: Theotherparameter is of the same type asselfand represents the other object that you want to subtract fromself.
§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§impl<'a, T1: Clone + NumAssign, T2: Clone + NumAssign> SubAssign<&'a Vector2<T1, T2>> for Point<T1, T2>
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>)
fn sub_assign(&mut self, other: &Vector2<T1, T2>)
-= operation. Read moreSource§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.
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>)
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: Theotherparameter in thesub_assignfunction is of typeVector2<T1, T2>. It represents another instance of theVector2struct with potentially different generic typesT1andT2. This parameter is used to subtract the `x_
impl<T1: Copy, T2: Copy> Copy for Point<T1, T2>
impl<T1: Eq, T2: Eq> Eq for Point<T1, T2>
impl<T1, T2> StructuralPartialEq for Point<T1, T2>
Auto Trait Implementations§
impl<T1, T2> Freeze for Point<T1, T2>
impl<T1, T2> RefUnwindSafe for Point<T1, T2>where
T1: RefUnwindSafe,
T2: RefUnwindSafe,
impl<T1, T2> Send for Point<T1, T2>
impl<T1, T2> Sync for Point<T1, T2>
impl<T1, T2> Unpin for Point<T1, T2>
impl<T1, T2> UnwindSafe for Point<T1, T2>where
T1: UnwindSafe,
T2: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Contain<Interval<T>> for Twhere
T: PartialOrd,
impl<T> Contain<Interval<T>> for Twhere
T: PartialOrd,
Source§fn contains(&self, _other: &Interval<T>) -> bool
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_otherparameter is a reference to anIntervalobject of the same typeTas the current object.
Returns:
The contains function is returning a boolean value false.
Source§impl<T> Intersect<Interval<T>> for T
impl<T> Intersect<Interval<T>> for T
Source§fn intersect_with(
&self,
other: &Interval<T>,
) -> <T as Intersect<Interval<T>>>::Output
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: Theotherparameter in theintersect_withfunction represents anotherInterval<T>that you want to intersect with the current interval.
type Output = Interval<T>
Source§impl<T> Overlap<Interval<T>> for Twhere
T: PartialOrd,
impl<T> Overlap<Interval<T>> for Twhere
T: PartialOrd,
Source§fn overlaps(&self, other: &Interval<T>) -> bool
fn overlaps(&self, other: &Interval<T>) -> bool
The overlaps function in Rust checks if two intervals overlap with each other.
Arguments:
other: Theotherparameter is a reference to anInterval<T>struct, which represents another interval. TheInterval<T>struct likely contains two fields,lbandub, representing the lower and upper bounds of the interval, respectively. Theoverlapsmethod 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.