Struct embedded_graphics::coord::Coord
source · Expand description
2D signed integer coordinate type
This coordinate should be used to define graphics object coordinates. For example, a
Rect
may be defined that has its top left at (-1,-2)
. To specify positive-only screen
coordinates and the like, see UnsignedCoord
Tuple Fields
0: i32
1: i32
Implementations
sourceimpl Coord
impl Coord
sourcepub fn clamp_positive(&self) -> Self
pub fn clamp_positive(&self) -> Self
Clamp coordinate components to positive integer range
Trait Implementations
sourceimpl AddAssign<Coord> for Coord
impl AddAssign<Coord> for Coord
sourcefn add_assign(&mut self, other: Coord)
fn add_assign(&mut self, other: Coord)
Performs the
+=
operation. Read moresourceimpl SubAssign<Coord> for Coord
impl SubAssign<Coord> for Coord
sourcefn sub_assign(&mut self, other: Coord)
fn sub_assign(&mut self, other: Coord)
Performs the
-=
operation. Read moresourceimpl ToUnsigned for Coord
impl ToUnsigned for Coord
sourcefn to_unsigned(self) -> UnsignedCoord
fn to_unsigned(self) -> UnsignedCoord
Convert to a positive-only coordinate, clamping negative values to zero
use embedded_graphics::coord::Coord;
use embedded_graphics::unsignedcoord::UnsignedCoord;
let coord = Coord::new(-5, 10);
assert_eq!(coord.to_unsigned(), UnsignedCoord::new(0, 10));
impl Copy for Coord
impl Eq for Coord
impl StructuralEq for Coord
impl StructuralPartialEq for Coord
Auto Trait Implementations
impl RefUnwindSafe for Coord
impl Send for Coord
impl Sync for Coord
impl Unpin for Coord
impl UnwindSafe for Coord
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more