pub struct SubRect {
pub x: i32,
pub y: i32,
pub size: Size,
}
Expand description
Helper struct for defining sub-rectangles.
A sub-rectangle is a rectangle that’s part of a bigger rectangle.
Fields§
§x: i32
X offset in pixels.
y: i32
Y offset in pixels.
size: Size
Size of the rectangle in pixels.
Implementations§
source§impl SubRect
impl SubRect
sourcepub fn shift<X, Y>(&self, new_x: X, new_y: Y) -> Selfwhere
X: ToPrimitive,
Y: ToPrimitive,
pub fn shift<X, Y>(&self, new_x: X, new_y: Y) -> Selfwhere
X: ToPrimitive,
Y: ToPrimitive,
Shift the left and top position while keeping the right and bottom position at the same spot.
Trait Implementations§
source§impl<X, Y, W, H> From<(X, Y, W, H)> for SubRect
impl<X, Y, W, H> From<(X, Y, W, H)> for SubRect
source§fn from((x, y, width, height): (X, Y, W, H)) -> Self
fn from((x, y, width, height): (X, Y, W, H)) -> Self
Converts to this type from the input type.
source§impl PartialEq for SubRect
impl PartialEq for SubRect
impl Copy for SubRect
impl Eq for SubRect
impl StructuralPartialEq for SubRect
Auto Trait Implementations§
impl RefUnwindSafe for SubRect
impl Send for SubRect
impl Sync for SubRect
impl Unpin for SubRect
impl UnwindSafe for SubRect
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more