[][src]Struct bracket_lib::prelude::Point

pub struct Point {
    pub x: i32,
    pub y: i32,
}

Helper struct defining a 2D point in space.

Fields

x: i32y: i32

Methods

impl Point[src]

#[must_use] pub fn new<T>(x: T, y: T) -> Point where
    T: TryInto<i32>, 
[src]

Create a new point from an x/y coordinate.

pub const fn constant(x: i32, y: i32) -> Point[src]

Create a new point from i32, this can be constant

pub fn zero() -> Point[src]

pub fn from_tuple<T>(t: (T, T)) -> Point where
    T: TryInto<i32>, 
[src]

pub fn to_index<T>(&self, width: T) -> usize where
    T: TryInto<usize>, 
[src]

Helper for map index conversion

pub fn to_tuple(&self) -> (i32, i32)[src]

Converts the point to an i32 tuple

pub fn to_unsigned_tuple(&self) -> (usize, usize)[src]

Converts the point to a usize tuple

pub fn to_vec2(&self) -> Vec2[src]

Converts the point to an UltraViolet vec2

pub fn to_vec2i(&self) -> Vec2i[src]

Converts the point to an UltraViolet vec2i

pub fn from_vec2(v: Vec2) -> Point[src]

Creates a point from an UltraViolet vec2

pub fn from_vec2i(v: Vec2i) -> Point[src]

Creates a point from an UltraViolet vec2i

Trait Implementations

impl Add<Point> for Point[src]

Overloads: We support basic point math Support adding a point to a point

type Output = Point

The resulting type after applying the + operator.

impl Add<i32> for Point[src]

Support adding an int to a point

type Output = Point

The resulting type after applying the + operator.

impl Clone for Point[src]

impl Copy for Point[src]

impl Debug for Point[src]

impl Div<Point> for Point[src]

Support dividing a point by a point

type Output = Point

The resulting type after applying the / operator.

impl Div<f32> for Point[src]

Support dividing a point by an f32

type Output = Point

The resulting type after applying the / operator.

impl Div<i32> for Point[src]

Support dividing a point by an int

type Output = Point

The resulting type after applying the / operator.

impl Eq for Point[src]

impl From<(f32, f32)> for Point[src]

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

impl From<Vec2> for Point[src]

impl From<Vec2i> for Point[src]

impl Hash for Point[src]

impl Mul<Point> for Point[src]

Support multiplying a point by a point

type Output = Point

The resulting type after applying the * operator.

impl Mul<f32> for Point[src]

Support multiplying a point by an f32

type Output = Point

The resulting type after applying the * operator.

impl Mul<i32> for Point[src]

Support multiplying a point by an int

type Output = Point

The resulting type after applying the * operator.

impl PartialEq<Point> for Point[src]

impl StructuralEq for Point[src]

impl StructuralPartialEq for Point[src]

impl Sub<Point> for Point[src]

Support subtracting a point from a point

type Output = Point

The resulting type after applying the - operator.

impl Sub<i32> for Point[src]

Support subtracting an int from a point

type Output = Point

The resulting type after applying the - operator.

Auto Trait Implementations

impl RefUnwindSafe for Point

impl Send for Point

impl Sync for Point

impl Unpin for Point

impl UnwindSafe for Point

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

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,