Skip to main content

Corners

Struct Corners 

Source
pub struct Corners {
    pub top_left: f64,
    pub top_right: f64,
    pub bottom_left: f64,
    pub bottom_right: f64,
}
Expand description

Four corner radii, independently – what lets a window be square-topped and round-bottomed, or any other combination, rather than one radius applied uniformly.

In logical pixels throughout, the same seam as Effect::radii: a style writes these, and does not know what scale the window will land on.

Fields§

§top_left: f64§top_right: f64§bottom_left: f64§bottom_right: f64

Implementations§

Source§

impl Corners

Source

pub const fn all(radius: f64) -> Self

One radius, all four corners. The common case, and the constructor that used to be Effect::rounded’s whole job before a window was allowed to differ corner to corner.

Source

pub const fn is_none(&self) -> bool

Whether every corner is <= 0.0 or NaN.

NaN is named rather than left to fall out of a negation, the same spelling the single-radius Effect::is_none_effect used before this existed: !(r > 0.0) says the same thing in fewer characters, but clippy rejects a negated comparison on a partially ordered type – and its objection is the point: NaN is incomparable, so r <= 0.0 on its own would call it rounded and draw every surface through a program to cut nothing.

Source

pub fn max_of_side(&self) -> (f64, f64, f64, f64)

Each side, measured by the larger of the two corners that touch it – (top, right, bottom, left). A square-topped, round-bottomed window must not give up its top rows to a corner it does not have.

Source

pub fn largest(&self) -> f64

The one number that stands for all four, for the clientRadius a layer is still told. The largest, because that field’s only in-tree use is an outward hug (PaneStyle.qml: clientRadius + 2, “hug it from outside”), and a hug has to clear the biggest cut or it clips into it.

Trait Implementations§

Source§

impl Clone for Corners

Source§

fn clone(&self) -> Corners

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for Corners

Source§

impl Debug for Corners

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for Corners

Source§

fn eq(&self, other: &Corners) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for Corners

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.