Struct analog_literals::Rectangle [−][src]
pub struct Rectangle { pub w: usize, pub h: usize, }
Expand description
A 2D Rectangle with a certain width and height.
Note that Rectangle
does not implement Eq
nor Ord
, as it would be rude
to assume that two literals are the same just because they are rotationally
transformed.
Example
Ever needed to define a particular aspect ratio? Well, why not represent that aspect ratio visually using a analog literal rectangle instead!
WARNING: aspect ratios may look a bit “off” depending on the font being used to display the source code. This is normal, and should not affect the correctness of the analog literal.
let aspect_ratio = analog_literal! { +--------+ | | | | | | +--------+ }; assert_eq!(aspect_ratio.w, 4); assert_eq!(aspect_ratio.h, 3);
Fields
w: usize
Width of the literal (counts how many --
wide the analog literal is)
h: usize
Height of the literal (counts how many |
tall the analog literal is)