pub struct Line<C: PixelColor> {
    pub start: Coord,
    pub end: Coord,
    pub style: Style<C>,
}
Expand description

Line primitive

Fields

start: Coord

Start point

end: Coord

End point

style: Style<C>

Line style

Implementations

Create a new line

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
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

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))
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))
line.translate_mut(Coord::new(10, 10));

assert_eq!(line.start, Coord::new(15, 20));
assert_eq!(line.end, Coord::new(25, 30));
Add a complete style to the object
Set the stroke colour for the object Read more
Set the stroke width for the object Read more
Set the fill property of the object’s style Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.