Struct exr::math::Vec2[][src]

pub struct Vec2<T>(pub T, pub T);

Simple two-dimensional vector of any numerical type. Supports only few mathematical operations as this is used mainly as data struct.

Implementations

impl<T> Vec2<T>[src]

pub fn max(self, other: Self) -> Self where
    T: Ord
[src]

Returns the vector with the maximum of either coordinates.

pub fn min(self, other: Self) -> Self where
    T: Ord
[src]

Returns the vector with the minimum of either coordinates.

pub fn try_from<S>(value: Vec2<S>) -> Result<Self, T::Error> where
    T: TryFrom<S>, 
[src]

Try to convert all components of this vector to a new type, yielding either a vector of that new type, or an error.

pub fn area(self) -> T where
    T: Mul<T, Output = T>, 
[src]

Seeing this vector as a dimension or size (width and height), this returns the area that this dimensions contains (width * height).

pub fn x(self) -> T[src]

The first component of this 2D vector.

pub fn y(self) -> T[src]

The second component of this 2D vector.

pub fn width(self) -> T[src]

The first component of this 2D vector.

pub fn height(self) -> T[src]

The second component of this 2D vector.

pub fn flat_index_for_size(self, resolution: Vec2<T>) -> T where
    T: Copy + Debug + Ord + Mul<Output = T> + Add<Output = T>, 
[src]

Convert this two-dimensional coordinate to an index suited for one-dimensional flattened image arrays. Works for images that store the pixels row by row, one after another, in a single array. In debug mode, panics for an index out of bounds.

impl Vec2<i32>[src]

pub fn to_usize(self, error_message: &'static str) -> Result<Vec2<usize>>[src]

Try to convert to Vec2<usize>, returning an error on negative numbers.

impl Vec2<usize>[src]

pub fn to_i32(self) -> Vec2<i32>[src]

Panics for too large values

Trait Implementations

impl<T: Add<T>> Add<Vec2<T>> for Vec2<T>[src]

type Output = Vec2<T::Output>

The resulting type after applying the + operator.

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

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

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

impl<T: Default> Default for Vec2<T>[src]

impl<T: Div<T>> Div<Vec2<T>> for Vec2<T>[src]

type Output = Vec2<T::Output>

The resulting type after applying the / operator.

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

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

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

impl<T: Mul<T>> Mul<Vec2<T>> for Vec2<T>[src]

type Output = Vec2<T::Output>

The resulting type after applying the * operator.

impl<T> Neg for Vec2<T> where
    T: Neg<Output = T>, 
[src]

type Output = Vec2<T>

The resulting type after applying the - operator.

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

impl<T> StructuralEq for Vec2<T>[src]

impl<T> StructuralPartialEq for Vec2<T>[src]

impl<T: Sub<T>> Sub<Vec2<T>> for Vec2<T>[src]

type Output = Vec2<T::Output>

The resulting type after applying the - operator.

Auto Trait Implementations

impl<T> RefUnwindSafe for Vec2<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for Vec2<T> where
    T: Send
[src]

impl<T> Sync for Vec2<T> where
    T: Sync
[src]

impl<T> Unpin for Vec2<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for Vec2<T> where
    T: UnwindSafe
[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<R, P> ReadPrimitive<R> for P where
    R: ReadEndian<P> + Read,
    P: Default
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.