Struct cursive::XY [] [src]

pub struct XY<T> {
    pub x: T,
    pub y: T,
}

A generic structure with a value for each axis.

Fields

X-axis value

Y-axis value

Methods

impl XY<usize>
[src]

[src]

Saturating subtraction. Computes self - other, saturating at 0.

Never panics.

[src]

Checked subtraction. Computes self - other if possible.

Returns None if self.x < other.x || self.y < other.y.

Never panics.

[src]

Returns a XY<isize> from self.

impl<T: Ord> XY<T>
[src]

[src]

Returns true if self could fit inside other.

Shortcut for self.x <= other.x && self.y <= other.y.

If this returns true, then other - self will not underflow.

[src]

Returns true if other could fit inside self.

Shortcut for self.x >= other.x && self.y >= other.y.

If this returns true, then self - other will not underflow.

[src]

Returns a new Vec2 that is a maximum per coordinate.

[src]

Returns a new Vec2 that is no larger than any input in both dimensions.

[src]

Returns the minimum of self and other.

[src]

Returns the maximum of self and other.

impl<T: Ord + Add<Output = T> + Clone> XY<T>
[src]

[src]

Returns (max(self.x,other.x), self.y+other.y)

[src]

Returns (self.x+other.x, max(self.y,other.y))

[src]

Returns true if self fits in the given rectangle.

impl<T: Zero + Clone> XY<T>
[src]

[src]

Returns a vector with the X component of self, and y=0.

[src]

Returns a vector with the Y component of self, and x=0.

[src]

Alias for Self::new(0,0).

impl<T> XY<T>
[src]

[src]

Creates a new XY from the given values.

[src]

Creates a new XY by applying f to x and y.

[src]

Destructure self into a pair.

[src]

Return a XY with references to this one's values.

[src]

Creates an iterator that returns references to x, then y.

[src]

Returns a reference to the value on the given axis.

[src]

Returns a mutable reference to the value on the given axis.

[src]

Returns a new XY of tuples made by zipping self and other.

[src]

Returns a new XY by calling f on self and other for each axis.

impl<T: Clone> XY<T>
[src]

[src]

Returns a new XY with the axis o set to value.

[src]

Returns a new XY with the axis o set to the value from other.

[src]

Sets the axis o on self to the value from other.

impl<T> XY<Option<T>>
[src]

[src]

Returns a new XY by calling unwrap_or on each axis.

impl XY<bool>
[src]

[src]

Returns true if any of x or y is true.

[src]

Returns true if both x and y are true.

impl<T: Copy> XY<T>
[src]

[src]

Creates a XY with both x and y set to value.

Trait Implementations

impl<T: PartialOrd> PartialOrd for XY<T>
[src]

[src]

a < b <=> a.x < b.x && a.y < b.y

1.0.0
[src]

This method tests less than (for self and other) and is used by the < operator. Read more

1.0.0
[src]

This method tests less than or equal to (for self and other) and is used by the <= operator. Read more

1.0.0
[src]

This method tests greater than (for self and other) and is used by the > operator. Read more

1.0.0
[src]

This method tests greater than or equal to (for self and other) and is used by the >= operator. Read more

impl<T: Into<XY<usize>>> From<T> for XY<isize>
[src]

[src]

Performs the conversion.

impl From<(i32, i32)> for XY<usize>
[src]

[src]

Performs the conversion.

impl From<(u32, u32)> for XY<usize>
[src]

[src]

Performs the conversion.

impl From<(u8, u8)> for XY<usize>
[src]

[src]

Performs the conversion.

impl From<(u16, u16)> for XY<usize>
[src]

[src]

Performs the conversion.

impl<T: Add<Output = T>, O: Into<XY<T>>> Add<O> for XY<T>
[src]

The resulting type after applying the + operator.

[src]

Performs the + operation.

impl<T: Sub<Output = T>, O: Into<XY<T>>> Sub<O> for XY<T>
[src]

The resulting type after applying the - operator.

[src]

Performs the - operation.

impl<T: Clone + Div<Output = T>> Div<T> for XY<T>
[src]

The resulting type after applying the / operator.

[src]

Performs the / operation.

impl Mul<usize> for XY<usize>
[src]

The resulting type after applying the * operator.

[src]

Performs the * operation.

impl<T: Debug> Debug for XY<T>
[src]

[src]

Formats the value using the given formatter.

impl<T: Clone> Clone for XY<T>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<T: Copy> Copy for XY<T>
[src]

impl<T: PartialEq> PartialEq for XY<T>
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl<T: Eq> Eq for XY<T>
[src]

impl<T: Hash> Hash for XY<T>
[src]

[src]

Feeds this value into the given [Hasher]. Read more

1.3.0
[src]

Feeds a slice of this type into the given [Hasher]. Read more

impl<T> From<(T, T)> for XY<T>
[src]

[src]

Performs the conversion.