pub struct RelativeRect {
pub unit: RelativeUnit,
pub rect: Rect,
}Expand description
Defines a rectangle that may be defined relative to a containing element.
Fields§
§unit: RelativeUnitThe unit of the rectangle.
rect: RectThe rectangle.
Implementations§
Source§impl RelativeRect
impl RelativeRect
Sourcepub const FILL: RelativeRect
pub const FILL: RelativeRect
A rectangle that represents 100% of an area.
Sourcepub const fn new(
x: f64,
y: f64,
width: f64,
height: f64,
unit: RelativeUnit,
) -> Self
pub const fn new( x: f64, y: f64, width: f64, height: f64, unit: RelativeUnit, ) -> Self
Initializes a new instance of the RelativeRect structure.
Sourcepub const fn from_rect(rect: Rect, unit: RelativeUnit) -> Self
pub const fn from_rect(rect: Rect, unit: RelativeUnit) -> Self
Initializes a RelativeRect from a Rect.
Sourcepub const fn from_size(size: Size, unit: RelativeUnit) -> Self
pub const fn from_size(size: Size, unit: RelativeUnit) -> Self
Initializes a RelativeRect at the origin with the given size.
Sourcepub const fn from_position_size(
position: Point,
size: Size,
unit: RelativeUnit,
) -> Self
pub const fn from_position_size( position: Point, size: Size, unit: RelativeUnit, ) -> Self
Initializes a RelativeRect from its position and size.
Sourcepub fn from_points(
top_left: Point,
bottom_right: Point,
unit: RelativeUnit,
) -> Self
pub fn from_points( top_left: Point, bottom_right: Point, unit: RelativeUnit, ) -> Self
Initializes a RelativeRect from its top left and bottom right corners.
Sourcepub fn equals(&self, p: RelativeRect) -> bool
pub fn equals(&self, p: RelativeRect) -> bool
Checks if the RelativeRect equals another rectangle.
Sourcepub fn to_pixels(&self, size: Size) -> Rect
pub fn to_pixels(&self, size: Size) -> Rect
Converts a RelativeRect into pixels, using size as the size of the
visual the rectangle is relative to.
Sourcepub fn to_pixels_rect(&self, bounding_box: Rect) -> Rect
pub fn to_pixels_rect(&self, bounding_box: Rect) -> Rect
Converts a RelativeRect into pixels, using bounding_box as the box the
rectangle is relative to.
Sourcepub fn parse(s: &str) -> Result<Self, FormatError>
pub fn parse(s: &str) -> Result<Self, FormatError>
Parses a RelativeRect string: four numbers (absolute) or four
percentages (relative).
Trait Implementations§
Source§impl BatchValue for RelativeRect
impl BatchValue for RelativeRect
Source§impl Clone for RelativeRect
impl Clone for RelativeRect
impl Copy for RelativeRect
Source§impl Debug for RelativeRect
impl Debug for RelativeRect
Source§impl Default for RelativeRect
impl Default for RelativeRect
Source§impl FromStr for RelativeRect
impl FromStr for RelativeRect
Source§impl MarkupTyped for RelativeRect
impl MarkupTyped for RelativeRect
Source§const MARKUP: &'static MarkupType
const MARKUP: &'static MarkupType
Source§impl PartialEq for RelativeRect
impl PartialEq for RelativeRect
Source§impl ServerPropertyValue for RelativeRect
impl ServerPropertyValue for RelativeRect
impl StructuralPartialEq for RelativeRect
Auto Trait Implementations§
impl Freeze for RelativeRect
impl RefUnwindSafe for RelativeRect
impl Send for RelativeRect
impl Sync for RelativeRect
impl Unpin for RelativeRect
impl UnsafeUnpin for RelativeRect
impl UnwindSafe for RelativeRect
Blanket Implementations§
Source§impl<T> AnyValue for Twhere
T: PartialEq + 'static,
impl<T> AnyValue for Twhere
T: PartialEq + 'static,
fn any_value_as_any(&self) -> &(dyn Any + 'static)
fn any_value_eq(&self, other: &(dyn AnyValue + 'static)) -> bool
fn any_value_type_name(&self) -> &'static str
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
Source§impl<T> ClassDefaults for Twhere
T: ?Sized,
impl<T> ClassDefaults for Twhere
T: ?Sized,
Source§fn static_constructor()
fn static_constructor()
affects_render, metadata
overrides). Read more