pub struct Rect { /* private fields */ }Expand description
Rectangle defining an area
Implementations§
Source§impl Rect
impl Rect
Sourcepub const fn subrect(
&self,
x: TSize,
y: TSize,
width: TSize,
height: TSize,
) -> Result<Rect, RectError>
pub const fn subrect( &self, x: TSize, y: TSize, width: TSize, height: TSize, ) -> Result<Rect, RectError>
Creates a new rect which is relative to the base coordinates of {0, 0} This will be relative to the base and check their bounds
Sourcepub fn subrect2(&self, offset: TPoint, size: TPoint) -> Result<Rect, RectError>
pub fn subrect2(&self, offset: TPoint, size: TPoint) -> Result<Rect, RectError>
Same as Self::subrect but with Vector2Ds as arguments
Sourcepub fn split(
&self,
orientation: Orientation,
ratio: Percent,
padding: TSize,
) -> Result<SplitRect, RectError>
pub fn split( &self, orientation: Orientation, ratio: Percent, padding: TSize, ) -> Result<SplitRect, RectError>
Splits the rect into two seperate rects at the given orientation’s line
ratio determines the size of the first rect, the other rect will occupy the remaining
size
‘padding’ might be adjusted towards 0 in case one of the rect’s area would be 0 => Thus
this method will always produce rects with a width/height of 1
Trait Implementations§
impl Copy for Rect
impl StructuralPartialEq for Rect
Auto Trait Implementations§
impl Freeze for Rect
impl RefUnwindSafe for Rect
impl Send for Rect
impl Sync for Rect
impl Unpin for Rect
impl UnsafeUnpin for Rect
impl UnwindSafe for Rect
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