pub struct Rectangle {
pub x: f32,
pub y: f32,
pub width: f32,
pub height: f32,
}
The X co-ordinate of the rectangle.
The Y co-ordinate of the rectangle.
The width of the rectangle.
The height of the rectangle.
Returns an infinite iterator of horizontally adjecent rectangles, starting at the specified
point and increasing along the X axis.
This can be useful when slicing spritesheets.
let rects: Vec<Rectangle> = Rectangle::row(0.0, 0.0, 16.0, 16.0).take(3).collect();
assert_eq!(Rectangle::new(0.0, 0.0, 16.0, 16.0), rects[0]);
assert_eq!(Rectangle::new(16.0, 0.0, 16.0, 16.0), rects[1]);
assert_eq!(Rectangle::new(32.0, 0.0, 16.0, 16.0), rects[2]);
Returns an infinite iterator of vertically adjecent rectangles, starting at the specified
point and increasing along the Y axis.
This can be useful when slicing spritesheets.
let rects: Vec<Rectangle> = Rectangle::column(0.0, 0.0, 16.0, 16.0).take(3).collect();
assert_eq!(Rectangle::new(0.0, 0.0, 16.0, 16.0), rects[0]);
assert_eq!(Rectangle::new(0.0, 16.0, 16.0, 16.0), rects[1]);
assert_eq!(Rectangle::new(0.0, 32.0, 16.0, 16.0), rects[2]);
This method tests for self
and other
values to be equal, and is used by ==
. Read more
This method tests for !=
.
Performs copy-assignment from source
. Read more
Formats the value using the given formatter. Read more
Creates owned data from borrowed data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (toowned_clone_into
)
recently added
Uses borrowed data to replace owned data, usually by cloning. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more
🔬 This is a nightly-only experimental API. (try_from
)
The type returned in the event of a conversion error.
🔬 This is a nightly-only experimental API. (try_from
)
🔬 This is a nightly-only experimental API. (get_type_id
)
this method will likely be replaced by an associated static
Tests if Self
the same as the type T
Read more
impl<SS, SP> SupersetOf for SP where SS: SubsetOf<SP>, | |
The inverse inclusion map: attempts to construct self
from the equivalent element of its superset. Read more
Checks if self
is actually part of its subset T
(and can be converted to it).
Use with care! Same as self.to_subset
but without any property checks. Always succeeds.
The inclusion map: converts self
to the equivalent element of its superset.
impl<T> SetParameter for T | |
fn set<T>(&mut self, value: T) -> <T as Parameter<Self>>::Result where T: Parameter<Self>, | |
Sets value
as a parameter of self
.