Struct embedded_graphics::prelude::Coord[][src]

pub struct Coord(pub i32, pub i32);

2D coordinate type

Methods

impl Coord
[src]

Create a new coordinate with X and Y values

Clamp coordinate components to positive integer range

Remove the sign from a coordinate

let coord = Coord::new(-5, -10);

assert_eq!(coord.abs(), Coord::new(5, 10));

Trait Implementations

impl Debug for Coord
[src]

Formats the value using the given formatter. Read more

impl Copy for Coord
[src]

impl Clone for Coord
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Eq for Coord
[src]

impl PartialEq for Coord
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Add for Coord
[src]

The resulting type after applying the + operator.

Performs the + operation.

impl AddAssign for Coord
[src]

Performs the += operation.

impl Sub for Coord
[src]

The resulting type after applying the - operator.

Performs the - operation.

impl SubAssign for Coord
[src]

Performs the -= operation.

impl Index<usize> for Coord
[src]

The returned type after indexing.

Performs the indexing (container[index]) operation.

impl ToUnsigned for Coord
[src]

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));

Auto Trait Implementations

impl Send for Coord

impl Sync for Coord