Struct usvg_tree::ScreenRect
source · pub struct ScreenRect { /* private fields */ }
Expand description
A 2D screen rect representation.
Width and height are guarantee to be > 0.
Implementations§
source§impl ScreenRect
impl ScreenRect
sourcepub fn new(x: i32, y: i32, width: u32, height: u32) -> Option<Self>
pub fn new(x: i32, y: i32, width: u32, height: u32) -> Option<Self>
Creates a new Rect
from values.
sourcepub fn size(&self) -> ScreenSize
pub fn size(&self) -> ScreenSize
Returns rect’s size.
sourcepub fn translate_to(&self, x: i32, y: i32) -> Self
pub fn translate_to(&self, x: i32, y: i32) -> Self
Translates the rect to the specified position.
sourcepub fn fit_to_rect(&self, bounds: ScreenRect) -> Self
pub fn fit_to_rect(&self, bounds: ScreenRect) -> Self
Fits the current rect into the specified bounds.
Trait Implementations§
source§impl Clone for ScreenRect
impl Clone for ScreenRect
source§fn clone(&self) -> ScreenRect
fn clone(&self) -> ScreenRect
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for ScreenRect
impl Debug for ScreenRect
source§impl Display for ScreenRect
impl Display for ScreenRect
source§impl PartialEq<ScreenRect> for ScreenRect
impl PartialEq<ScreenRect> for ScreenRect
source§fn eq(&self, other: &ScreenRect) -> bool
fn eq(&self, other: &ScreenRect) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.