Skip to main content

Crate ixy

Crate ixy 

Source
Expand description

A terse, no-std crate for 2D integer geometry.

§Examples

use ixy::{Pos, Rect};

let pos = Pos::new(10, 20);
let rect = Rect::from_ltwh(0, 0, 100, 200);

assert_eq!(pos.x, 10);
assert_eq!(pos.y, 20);
assert_eq!(rect.left(), 0);
assert_eq!(rect.top(), 0);
assert_eq!(rect.width(), 100);
assert_eq!(rect.height(), 200);
assert_eq!(rect.right(), 100);
assert_eq!(rect.bottom(), 200);
assert!(rect.contains_pos(pos));
assert!(!rect.contains_pos(Pos::new(150, 250)));

Modules§

index
Tools for mapping between 2D grid coordinates and 1D memory indices.
int
Sealed traits implemented by all of Rust’s primitive integer types.
ops
Operations on 2D geometric types.

Macros§

pos
A macro that creates a position with the given x and y coordinates.
rect
A macro that creates a rectangle with the given coordinates.

Structs§

Pos
A 2-dimensional point with integer precision.
Rect
A 2-dimensional rectangle with integer precision.
Size
Represents a size in 2D space, with width and height.

Enums§

RectError
Error type for rectangle operations.
TryFromPosError
An error type for when a Pos<T> cannot be converted to another type.

Traits§

HasSize
A type that has a Size.
TryFromPos
A trait for converting a Pos<T> to another type.
TryIntoPos
A trait for converting a Pos<T> to another type.