Struct embedded_graphics::primitives::rect::Rect [−][src]
Rectangle primitive
Fields
top_left: Coord
Top left point of the rect
bottom_right: Coord
Bottom right point of the rect
color: Color
Border color
Methods
impl Rect[src]
impl Rectpub fn new(top_left: Coord, bottom_right: Coord, color: u8) -> Self[src]
pub fn new(top_left: Coord, bottom_right: Coord, color: u8) -> SelfCreate a new rectangle from the top left point to the bottom right point with a given border color
Trait Implementations
impl Debug for Rect[src]
impl Debug for Rectfn fmt(&self, f: &mut Formatter) -> Result[src]
fn fmt(&self, f: &mut Formatter) -> ResultFormats the value using the given formatter. Read more
impl Clone for Rect[src]
impl Clone for Rectfn clone(&self) -> Rect[src]
fn clone(&self) -> RectReturns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
fn clone_from(&mut self, source: &Self)1.0.0
[src]Performs copy-assignment from source. Read more
impl Copy for Rect[src]
impl Copy for Rectimpl<'a> IntoIterator for &'a Rect[src]
impl<'a> IntoIterator for &'a Recttype Item = Pixel
The type of the elements being iterated over.
type IntoIter = RectIterator
Which kind of iterator are we turning this into?
fn into_iter(self) -> Self::IntoIter[src]
fn into_iter(self) -> Self::IntoIterCreates an iterator from a value. Read more
impl Drawable for Rect[src]
impl Drawable for Rectimpl Transform for Rect[src]
impl Transform for Rectfn translate(&self, by: Coord) -> Self[src]
fn translate(&self, by: Coord) -> SelfTranslate the rect from its current position to a new position by (x, y) pixels, returning
a new Rect. For a mutating transform, see translate_mut.
let rect = Rect::new(Coord::new(5, 10), Coord::new(15, 20), 1); let moved = rect.translate(Coord::new(10, 10)); assert_eq!(moved.top_left, Coord::new(15, 20)); assert_eq!(moved.bottom_right, Coord::new(25, 30));
fn translate_mut(&mut self, by: Coord) -> &mut Self[src]
fn translate_mut(&mut self, by: Coord) -> &mut SelfTranslate the rect from its current position to a new position by (x, y) pixels.
let mut rect = Rect::new(Coord::new(5, 10), Coord::new(15, 20), 1); rect.translate_mut(Coord::new(10, 10)); assert_eq!(rect.top_left, Coord::new(15, 20)); assert_eq!(rect.bottom_right, Coord::new(25, 30));