Trait IsBuildable2D

Source
pub trait IsBuildable2D:
    Sized
    + Is2D
    + IsBuildableND
    + Eq
    + PartialEq
    + Ord
    + PartialOrd
    + Hash {
    // Required methods
    fn new(x: f64, y: f64) -> Self;
    fn from<P>(&mut self, other: &P)
       where P: Is2D;

    // Provided methods
    fn new_from<P>(other: &P) -> Self
       where P: Is2D { ... }
    fn normalized(&self) -> Result<Self> { ... }
    fn zero() -> Self { ... }
    fn multiply_m(&self, m: &Matrix3) -> Self { ... }
    fn parse(text: &str) -> Result<Self> { ... }
    fn center<P>(&self, other: &P) -> Self
       where P: Is2D { ... }
}
Expand description

IsBuildable2D is a trait used for types which are positioned in 2D space and can be constructed

Required Methods§

Source

fn new(x: f64, y: f64) -> Self

Should build an object from x and y coordinates

Source

fn from<P>(&mut self, other: &P)
where P: Is2D,

Should use the coordinates of another as its own

Provided Methods§

Source

fn new_from<P>(other: &P) -> Self
where P: Is2D,

Uses the coordinates of other to create a new

Source

fn normalized(&self) -> Result<Self>

Returns this with normalized values

Source

fn zero() -> Self

Returns a new object with 0/0 as coordinates

Source

fn multiply_m(&self, m: &Matrix3) -> Self

Applies a matrix to this

Source

fn parse(text: &str) -> Result<Self>

Creates this from a “x y” string. E.g. “4.3 17.29”

Source

fn center<P>(&self, other: &P) -> Self
where P: Is2D,

Returns the center between this and other

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§