Struct embedded_graphics::primitives::line::Line[][src]

pub struct Line<C: PixelColor> {
    pub start: Coord,
    pub end: Coord,
    pub color: C,
}

Line primitive

Fields

Start point

End point

Line color

Methods

impl<C> Line<C> where
    C: PixelColor
[src]

Create a new line

Trait Implementations

impl<C: Debug + PixelColor> Debug for Line<C>
[src]

Formats the value using the given formatter. Read more

impl<C: Copy + PixelColor> Copy for Line<C>
[src]

impl<C: Clone + PixelColor> Clone for Line<C>
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl<'a, C: PixelColor> IntoIterator for &'a Line<C>
[src]

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

impl<C> Drawable for Line<C> where
    C: PixelColor
[src]

impl<C> Transform for Line<C> where
    C: PixelColor
[src]

Translate the line from its current position to a new position by (x, y) pixels, returning a new Line. For a mutating transform, see translate_mut.


let line = Line::new(Coord::new(5, 10), Coord::new(15, 20), 1u8);
let moved = line.translate(Coord::new(10, 10));

assert_eq!(moved.start, Coord::new(15, 20));
assert_eq!(moved.end, Coord::new(25, 30));

Translate the line from its current position to a new position by (x, y) pixels.


let mut line = Line::new(Coord::new(5, 10), Coord::new(15, 20), 1u8);
line.translate_mut(Coord::new(10, 10));

assert_eq!(line.start, Coord::new(15, 20));
assert_eq!(line.end, Coord::new(25, 30));

Auto Trait Implementations

impl<C> Send for Line<C> where
    C: Send

impl<C> Sync for Line<C> where
    C: Sync