pub struct Drawable<T: Clone> { /* private fields */ }
Expand description

Represents a shape that is made of points that can be drawn either as a outline or solid

Implementations§

source§

impl<T: Clone> Drawable<T>

source

pub fn obj(&self) -> &T

source

pub fn draw_type(&self) -> DrawType

source

pub fn drawing_points(&self) -> &Vec<Coord>

source§

impl<T: Clone> Drawable<T>

source

pub fn new(obj: T, draw_type: DrawType, drawing_points: Vec<Coord>) -> Drawable<T>

source§

impl<T: Clone> Drawable<T>

source

pub fn with_draw_type(&self, draw_type: DrawType) -> Drawable<T>

source§

impl<T> Drawable<T>where Self: CreateDrawable<T>, T: Shape + Clone,

source

pub fn with_translation<P: Into<Coord>>(&self, delta: P) -> Drawable<T>

source

pub fn with_move<P: Into<Coord>>(&self, xy: P) -> Drawable<T>

source

pub fn with_scale(&self, scale: f32) -> Drawable<T>

source

pub fn with_scale_around<P: Into<Coord>>( &self, scale: f32, point: P ) -> Drawable<T>

source

pub fn with_rotation(&self, degrees: isize) -> Drawable<T>

source

pub fn with_rotation_around<P: Into<Coord>>( &self, degrees: isize, point: P ) -> Drawable<T>

Trait Implementations§

source§

impl<T: Clone + Clone> Clone for Drawable<T>

source§

fn clone(&self) -> Drawable<T>

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl CreateDrawable<Circle> for Drawable<Circle>

source§

fn from_obj(shape: Circle, draw_type: DrawType) -> Drawable<Circle>

source§

impl CreateDrawable<Ellipse> for Drawable<Ellipse>

source§

fn from_obj(shape: Ellipse, draw_type: DrawType) -> Drawable<Ellipse>

source§

impl CreateDrawable<Line> for Drawable<Line>

source§

fn from_obj(line: Line, draw_type: DrawType) -> Drawable<Line>

source§

impl CreateDrawable<Polygon> for Drawable<Polygon>

source§

fn from_obj(shape: Polygon, draw_type: DrawType) -> Drawable<Polygon>

source§

impl CreateDrawable<Rect> for Drawable<Rect>

source§

fn from_obj(rect: Rect, draw_type: DrawType) -> Drawable<Rect>

source§

impl CreateDrawable<Triangle> for Drawable<Triangle>

source§

fn from_obj(triangle: Triangle, draw_type: DrawType) -> Drawable<Triangle>

source§

impl<T: Debug + Clone> Debug for Drawable<T>

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl<S: Clone> From<Drawable<S>> for ShapeBoxwhere ShapeBox: FromDrawable<S>,

source§

fn from(value: Drawable<S>) -> Self

Converts to this type from the input type.
source§

impl<T: PartialEq + Clone> PartialEq<Drawable<T>> for Drawable<T>

source§

fn eq(&self, other: &Drawable<T>) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Renderable<Circle> for Drawable<Circle>

source§

fn render(&self, graphics: &mut Graphics<'_>)

source§

impl Renderable<Ellipse> for Drawable<Ellipse>

source§

fn render(&self, graphics: &mut Graphics<'_>)

source§

impl Renderable<Line> for Drawable<Line>

source§

fn render(&self, graphics: &mut Graphics<'_>)

source§

impl Renderable<Polygon> for Drawable<Polygon>

source§

fn render(&self, graphics: &mut Graphics<'_>)

source§

impl Renderable<Rect> for Drawable<Rect>

source§

fn render(&self, graphics: &mut Graphics<'_>)

source§

impl Renderable<Triangle> for Drawable<Triangle>

source§

fn render(&self, graphics: &mut Graphics<'_>)

source§

impl<T: Eq + Clone> Eq for Drawable<T>

source§

impl<T: Clone> StructuralEq for Drawable<T>

source§

impl<T: Clone> StructuralPartialEq for Drawable<T>

Auto Trait Implementations§

§

impl<T> RefUnwindSafe for Drawable<T>where T: RefUnwindSafe,

§

impl<T> Send for Drawable<T>where T: Send,

§

impl<T> Sync for Drawable<T>where T: Sync,

§

impl<T> Unpin for Drawable<T>where T: Unpin,

§

impl<T> UnwindSafe for Drawable<T>where T: UnwindSafe,

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

const: unstable · source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

const: unstable · source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for Twhere U: From<T>,

const: unstable · source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
const: unstable · source§

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

Performs the conversion.