FerroUI/ docs

Search guides, controls, Rust APIs, and XAML.

    GitHub ↗

    RelativeRect

    struct · ferroui-base · v0.5.0

    struct RelativeRect
    

    Defines a rectangle that may be defined relative to a containing element.

    View source

    Members

    unit

    unit: crate::RelativeUnit
    

    The unit of the rectangle.

    Source

    rect

    rect: crate::Rect
    

    The rectangle.

    Source

    FILL

    const FILL: RelativeRect
    

    A rectangle that represents 100% of an area.

    Source

    new

    const fn new(x: f64, y: f64, width: f64, height: f64, unit: RelativeUnit) -> Self
    

    Initializes a new instance of the RelativeRect structure.

    Source

    from_rect

    const fn from_rect(rect: Rect, unit: RelativeUnit) -> Self
    

    Initializes a RelativeRect from a Rect.

    Source

    from_size

    const fn from_size(size: Size, unit: RelativeUnit) -> Self
    

    Initializes a RelativeRect at the origin with the given size.

    Source

    from_position_size

    const fn from_position_size(position: Point, size: Size, unit: RelativeUnit) -> Self
    

    Initializes a RelativeRect from its position and size.

    Source

    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.

    Source

    equals

    fn equals(self: &Self, p: RelativeRect) -> bool
    

    Checks if the RelativeRect equals another rectangle.

    Source

    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.

    Source

    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.

    Source

    parse

    fn parse(s: &str) -> Result<Self, FormatError>
    

    Parses a RelativeRect string: four numbers (absolute) or four percentages (relative).

    Source

    Trait implementations

    • Send
    • Sync
    • Freeze
    • UnsafeUnpin
    • Unpin
    • UnwindSafe
    • RefUnwindSafe
    • PropertyValue
    • AnyValue
    • ClassDefaults
    • Borrow<T>
    • BorrowMut<T>
    • CloneToUninit
    • Into<U>
    • From<T>
    • TryInto<U>
    • TryFrom<U>
    • Any
    • ToOwned
    • ErasedDestructor
    • IntoEither
    • ServerPropertyValue
    • BatchValue
    • MarkupTyped
    • ValueTypeRegistration
    • Clone
    • Copy
    • Debug
    • StructuralPartialEq
    • PartialEq
    • Default
    • FromStr

    Availability

    Extracted for aarch64-apple-darwin. Cargo features are listed in the crate index.