[][src]Struct orbtk_utils::Point

pub struct Point { /* fields omitted */ }

A Point is specified by a x coordinate and an y coordinate.

Examples

let point = Point::new(10., 10.);
let other_point = Point::new(5., 7.);
let result = size - other_point;

assert_eq!(result.x(), 5.);
assert_eq!(result.y(), 3.);

Implementations

impl Point[src]

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

impl Point[src]

pub fn distance(&self, other: Self) -> f64[src]

Returns the distance between this Point and the given Point.

pub fn x(&self) -> f64[src]

Gets the x position of the point.

pub fn set_x(&mut self, x: impl Into<f64>)[src]

Sets the x position of the point.

pub fn y(&self) -> f64[src]

Gets the y position of the point.

pub fn set_y(&mut self, y: impl Into<f64>)[src]

Sets the y position of the point.

Trait Implementations

impl Add<Point> for Point[src]

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 Default for Point[src]

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

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

impl From<f64> for Point[src]

impl From<i32> for Point[src]

impl PartialEq<Point> for Point[src]

impl StructuralPartialEq for Point[src]

impl Sub<Point> for Point[src]

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.