RelativeRect
struct · ferroui-base · v0.5.0
struct RelativeRect
Defines a rectangle that may be defined relative to a containing element.
Members
unitrectFILLnewfrom_rectfrom_sizefrom_position_sizefrom_pointsequalsto_pixelsto_pixels_rectparse
unit
unit: crate::RelativeUnit
The unit of the rectangle.
rect
rect: crate::Rect
The rectangle.
FILL
const FILL: RelativeRect
A rectangle that represents 100% of an area.
new
const fn new(x: f64, y: f64, width: f64, height: f64, unit: RelativeUnit) -> Self
Initializes a new instance of the RelativeRect structure.
from_rect
const fn from_rect(rect: Rect, unit: RelativeUnit) -> Self
Initializes a RelativeRect from a Rect.
from_size
const fn from_size(size: Size, unit: RelativeUnit) -> Self
Initializes a RelativeRect at the origin with the given size.
from_position_size
const fn from_position_size(position: Point, size: Size, unit: RelativeUnit) -> Self
Initializes a RelativeRect from its position and size.
from_points
fn from_points(top_left: Point, bottom_right: Point, unit: RelativeUnit) -> Self
Initializes a RelativeRect from its top left and bottom right corners.
equals
fn equals(self: &Self, p: RelativeRect) -> bool
Checks if the RelativeRect equals another rectangle.
to_pixels
fn to_pixels(self: &Self, size: Size) -> Rect
Converts a RelativeRect into pixels, using size as the size of the
visual the rectangle is relative to.
to_pixels_rect
fn to_pixels_rect(self: &Self, bounding_box: Rect) -> Rect
Converts a RelativeRect into pixels, using bounding_box as the box the
rectangle is relative to.
parse
fn parse(s: &str) -> Result<Self, FormatError>
Parses a RelativeRect string: four numbers (absolute) or four
percentages (relative).
Trait implementations
SendSyncFreezeUnsafeUnpinUnpinUnwindSafeRefUnwindSafePropertyValueAnyValueClassDefaultsBorrow<T>BorrowMut<T>CloneToUninitInto<U>From<T>TryInto<U>TryFrom<U>AnyToOwnedErasedDestructorIntoEitherServerPropertyValueBatchValueMarkupTypedValueTypeRegistrationCloneCopyDebugStructuralPartialEqPartialEqDefaultFromStr
Availability
Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.