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

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.

Methods

impl<T> Vec2<T>[src]

pub fn map<B>(self, map: impl Fn(T) -> B) -> Vec2<B>[src]

Maps all components of this vector to a new type, yielding a vector of that new type.

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).

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: 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: 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

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

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

impl<T> Unpin for Vec2<T> where
    T: Unpin

impl<T> UnwindSafe for Vec2<T> where
    T: UnwindSafe

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
    P: Default,
    R: ReadEndian<P> + Read
[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.