Struct simple_game_engine::prelude::Point[][src]

pub struct Point { /* fields omitted */ }

Immutable point type, consisting of x and y.

Implementations

impl Point[src]

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

Creates a new point from the given coordinates.

pub fn from_ll(raw: SDL_Point) -> Point[src]

pub fn raw_slice(slice: &[Point]) -> *const SDL_Point[src]

pub fn raw(&self) -> *const SDL_Point[src]

pub fn offset(self, x: i32, y: i32) -> Point[src]

Returns a new point by shifting this point’s coordinates by the given x and y values.

pub fn scale(self, f: i32) -> Point[src]

Returns a new point by multiplying this point’s coordinates by the given scale factor.

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

Returns the x-coordinate of this point.

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

Returns the y-coordinate of this point.

Trait Implementations

impl Add<Point> for Point[src]

type Output = Point

The resulting type after applying the + operator.

pub fn add(self, rhs: Point) -> Point[src]

Performs the + operation. Read more

impl AddAssign<Point> for Point[src]

pub fn add_assign(&mut self, rhs: Point)[src]

Performs the += operation. Read more

impl AsMut<SDL_Point> for Point[src]

pub fn as_mut(&mut self) -> &mut SDL_Point[src]

Performs the conversion.

impl AsRef<SDL_Point> for Point[src]

pub fn as_ref(&self) -> &SDL_Point[src]

Performs the conversion.

impl Clone for Point[src]

pub fn clone(&self) -> Point[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for Point[src]

pub fn fmt(&self, fmt: &mut Formatter<'_>) -> Result<(), Error>[src]

Formats the value using the given formatter. Read more

impl Deref for Point[src]

pub fn deref(&self) -> &SDL_Point[src]

Example

use sdl2::rect::Point;
let point = Point::new(2, 3);
assert_eq!(2, point.x);

type Target = SDL_Point

The resulting type after dereferencing.

impl DerefMut for Point[src]

pub fn deref_mut(&mut self) -> &mut SDL_Point[src]

Example

use sdl2::rect::Point;
let mut point = Point::new(2, 3);
point.x = 4;
assert_eq!(4, point.x);

impl Div<i32> for Point[src]

type Output = Point

The resulting type after applying the / operator.

pub fn div(self, rhs: i32) -> Point[src]

Performs the / operation. Read more

impl DivAssign<i32> for Point[src]

pub fn div_assign(&mut self, rhs: i32)[src]

Performs the /= operation. Read more

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

pub fn from((i32, i32)) -> Point[src]

Performs the conversion.

impl From<SDL_Point> for Point[src]

pub fn from(prim: SDL_Point) -> Point[src]

Performs the conversion.

impl Hash for Point[src]

pub fn hash<H>(&self, state: &mut H) where
    H: Hasher
[src]

Feeds this value into the given Hasher. Read more

fn hash_slice<H>(data: &[Self], state: &mut H) where
    H: Hasher
1.3.0[src]

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

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

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

Performs the conversion.

impl Into<SDL_Point> for Point[src]

pub fn into(self) -> SDL_Point[src]

Performs the conversion.

impl Mul<i32> for Point[src]

type Output = Point

The resulting type after applying the * operator.

pub fn mul(self, rhs: i32) -> Point[src]

Performs the * operation. Read more

impl MulAssign<i32> for Point[src]

pub fn mul_assign(&mut self, rhs: i32)[src]

Performs the *= operation. Read more

impl Neg for Point[src]

type Output = Point

The resulting type after applying the - operator.

pub fn neg(self) -> Point[src]

Performs the unary - operation. Read more

impl PartialEq<Point> for Point[src]

pub fn eq(&self, other: &Point) -> bool[src]

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

#[must_use]
fn ne(&self, other: &Rhs) -> bool
1.0.0[src]

This method tests for !=.

impl Sub<Point> for Point[src]

type Output = Point

The resulting type after applying the - operator.

pub fn sub(self, rhs: Point) -> Point[src]

Performs the - operation. Read more

impl SubAssign<Point> for Point[src]

pub fn sub_assign(&mut self, rhs: Point)[src]

Performs the -= operation. Read more

impl Copy for Point[src]

impl Eq for Point[src]

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]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

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.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

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.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.