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]

Returns a Vec2 with usize::max_value() in each axis.

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

Never panics.

Saturating addition with a signed vec.

Any coordinates saturates to 0.

Term-by-term integer division that rounds up.

Checked subtraction. Computes self - other if possible.

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

Never panics.

Returns a XY<isize> from self.

impl<T: Ord> XY<T>
[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.

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.

Returns a new Vec2 that is a maximum per coordinate.

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

Returns the minimum of self and other.

Returns the maximum of self and other.

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

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

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

Returns true if self fits in the given rectangle.

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

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

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

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

impl<T> XY<T>
[src]

Creates a new XY from the given values.

Swaps the x and y values.

Returns f(self.x, self.y)

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

Applies f on axis where condition is true.

Carries over self otherwise.

Applies f on axis where condition is true.

Returns None otherwise.

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

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

Destructure self into a pair.

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

Important traits for Chain<A, B>

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

Important traits for &'a mut R

Returns a reference to the value on the given axis.

Important traits for &'a mut R

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

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

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

Returns a new XY of tuples made by zipping self, a, b and c.

Returns a new XY of tuples made by zipping self, a, b, c and d.

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

For each axis, keep the element from self if keep is true.

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

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

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

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

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

Returns a new XY by calling unwrap_or on each axis.

impl XY<bool>
[src]

Returns true if any of x or y is true.

Returns true if both x and y are true.

For each axis, keeps elements from other if self is true.

For each axis, selects if_true if self is true, else if_false.

Returns a term-by-term AND operation.

Returns a term-by-term OR operation.

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

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

Trait Implementations

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

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

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

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

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

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

impl<'a, T> From<&'a XY<T>> for XY<T> where
    T: Clone
[src]

Performs the conversion.

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

Performs the conversion.

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

Performs the conversion.

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

Performs the conversion.

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

Performs the conversion.

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

Performs the conversion.

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

The resulting type after applying the + operator.

Performs the + operation.

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

The resulting type after applying the - operator.

Performs the - operation.

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

The resulting type after applying the / operator.

Performs the / operation.

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

The resulting type after applying the * operator.

Performs the * operation.

impl<T> Mul<XY<T>> for XY<T> where
    T: Mul<T>, 
[src]

The resulting type after applying the * operator.

Performs the * operation.

impl<T> Div<XY<T>> for XY<T> where
    T: Div<T>, 
[src]

The resulting type after applying the / operator.

Performs the / operation.

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

Formats the value using the given formatter. Read more

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

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

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

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

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

This method tests for !=.

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

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

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

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

impl<T> IntoIterator for XY<T>
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

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

Performs the conversion.

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

Performs the conversion.

Auto Trait Implementations

impl<T> Send for XY<T> where
    T: Send

impl<T> Sync for XY<T> where
    T: Sync