Struct i_slint_core::BorderRadius

source ·
#[repr(C)]
pub struct BorderRadius<T, U> { pub top_left: T, pub top_right: T, pub bottom_right: T, pub bottom_left: T, /* private fields */ }
Expand description

Top-left, top-right, bottom-right, and bottom-left border radius, optionally tagged with a unit.

Fields§

§top_left: T

The top-left radius.

§top_right: T

The top-right radius.

§bottom_right: T

The bottom-right radius.

§bottom_left: T

The bottom-left radius.

Implementations§

source§

impl<T, U> BorderRadius<T, U>

source

pub const fn new( top_left: T, top_right: T, bottom_right: T, bottom_left: T ) -> Self

Constructor taking a scalar for each radius.

Radii are specified in top-left, top-right, bottom-right, bottom-left order following CSS’s convention.

source

pub fn from_lengths( top_left: Length<T, U>, top_right: Length<T, U>, bottom_right: Length<T, U>, bottom_left: Length<T, U> ) -> Self

Constructor taking a typed Length for each radius.

Radii are specified in top-left, top-right, bottom-right, bottom-left order following CSS’s convention.

source

pub fn new_uniform(all: T) -> Self
where T: Copy,

Constructor taking the same scalar value for all radii.

source

pub fn from_length(all: Length<T, U>) -> Self
where T: Copy,

Constructor taking the same typed Length for all radii.

source

pub fn is_uniform(&self) -> bool
where T: ApproxEq<T>,

Returns true if all radii are equal.

source

pub fn as_uniform(&self) -> Option<T>
where T: Copy + ApproxEq<T>,

Returns the uniform radius if all are equal, or None otherwise.

source

pub fn is_zero(&self) -> bool
where T: ApproxEq<T> + Zero,

Returns true if all radii are zero.

source

pub fn outer(&self, half_border_width: Length<T, U>) -> Self
where T: Copy + PartialOrd + Zero,

Returns the outer radius.

For any corner with a positive radius, the radius is ensured to be at least half_border_width.

source

pub fn inner(&self, half_border_width: Length<T, U>) -> Self
where T: Copy + PartialOrd + Sub<T, Output = T> + Zero,

Returns the inner radius.

A positive radius of each corner is subtracted by half_border_width and min-clamped to zero.

source§

impl<T, U> BorderRadius<T, U>
where T: PartialOrd,

source

pub fn min(self, other: Self) -> Self

Returns the minimum of the two radii.

source

pub fn max(self, other: Self) -> Self

Returns the maximum of the two radii.

source§

impl<T, U> BorderRadius<T, U>
where T: NumCast + Copy,

source

pub fn cast<NewT: NumCast>(self) -> BorderRadius<NewT, U>

Cast from one numeric representation to another, preserving the units.

source

pub fn try_cast<NewT: NumCast>(self) -> Option<BorderRadius<NewT, U>>

Fallible cast from one numeric representation to another, preserving the units.

Trait Implementations§

source§

impl<T, U> Add for BorderRadius<T, U>
where T: Add<T, Output = T>,

§

type Output = BorderRadius<T, U>

The resulting type after applying the + operator.
source§

fn add(self, other: Self) -> Self

Performs the + operation. Read more
source§

impl<T, U> AddAssign for BorderRadius<T, U>
where T: AddAssign<T>,

source§

fn add_assign(&mut self, other: Self)

Performs the += operation. Read more
source§

impl<T, U> Clone for BorderRadius<T, U>
where T: Clone,

source§

fn clone(&self) -> Self

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<T, U> Debug for BorderRadius<T, U>
where T: Debug,

source§

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

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

impl<T, U> Default for BorderRadius<T, U>
where T: Default,

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl<T, U1, U2> Div<Scale<T, U1, U2>> for BorderRadius<T, U2>
where T: Copy + Div,

§

type Output = BorderRadius<<T as Div>::Output, U1>

The resulting type after applying the / operator.
source§

fn div(self, scale: Scale<T, U1, U2>) -> Self::Output

Performs the / operation. Read more
source§

impl<T, U> Div<T> for BorderRadius<T, U>
where T: Copy + Div,

§

type Output = BorderRadius<<T as Div>::Output, U>

The resulting type after applying the / operator.
source§

fn div(self, scale: T) -> Self::Output

Performs the / operation. Read more
source§

impl<T, U> DivAssign<Scale<T, U, U>> for BorderRadius<T, U>
where T: Copy + DivAssign,

source§

fn div_assign(&mut self, other: Scale<T, U, U>)

Performs the /= operation. Read more
source§

impl<T, U> DivAssign<T> for BorderRadius<T, U>
where T: Copy + DivAssign,

source§

fn div_assign(&mut self, other: T)

Performs the /= operation. Read more
source§

impl<T, U1, U2> Mul<Scale<T, U1, U2>> for BorderRadius<T, U1>
where T: Copy + Mul,

§

type Output = BorderRadius<<T as Mul>::Output, U2>

The resulting type after applying the * operator.
source§

fn mul(self, scale: Scale<T, U1, U2>) -> Self::Output

Performs the * operation. Read more
source§

impl<T, U> Mul<T> for BorderRadius<T, U>
where T: Copy + Mul,

§

type Output = BorderRadius<<T as Mul>::Output, U>

The resulting type after applying the * operator.
source§

fn mul(self, scale: T) -> Self::Output

Performs the * operation. Read more
source§

impl<T, U> MulAssign<Scale<T, U, U>> for BorderRadius<T, U>
where T: Copy + MulAssign,

source§

fn mul_assign(&mut self, other: Scale<T, U, U>)

Performs the *= operation. Read more
source§

impl<T, U> MulAssign<T> for BorderRadius<T, U>
where T: Copy + MulAssign,

source§

fn mul_assign(&mut self, other: T)

Performs the *= operation. Read more
source§

impl<T, U> Neg for BorderRadius<T, U>
where T: Neg<Output = T>,

§

type Output = BorderRadius<T, U>

The resulting type after applying the - operator.
source§

fn neg(self) -> Self

Performs the unary - operation. Read more
source§

impl<T, U> PartialEq for BorderRadius<T, U>
where T: PartialEq,

source§

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

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

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

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl<T, U> Sub for BorderRadius<T, U>
where T: Sub<T, Output = T>,

§

type Output = BorderRadius<T, U>

The resulting type after applying the - operator.
source§

fn sub(self, other: Self) -> Self

Performs the - operation. Read more
source§

impl<T, U> SubAssign for BorderRadius<T, U>
where T: SubAssign<T>,

source§

fn sub_assign(&mut self, other: Self)

Performs the -= operation. Read more
source§

impl<T, U> Zero for BorderRadius<T, U>
where T: Zero,

source§

fn zero() -> Self

source§

impl<T, U> Copy for BorderRadius<T, U>
where T: Copy,

source§

impl<T, U> Eq for BorderRadius<T, U>
where T: Eq,

Auto Trait Implementations§

§

impl<T, U> Freeze for BorderRadius<T, U>
where T: Freeze,

§

impl<T, U> RefUnwindSafe for BorderRadius<T, U>

§

impl<T, U> Send for BorderRadius<T, U>
where T: Send, U: Send,

§

impl<T, U> Sync for BorderRadius<T, U>
where T: Sync, U: Sync,

§

impl<T, U> Unpin for BorderRadius<T, U>
where T: Unpin, U: Unpin,

§

impl<T, U> UnwindSafe for BorderRadius<T, U>
where T: UnwindSafe, U: UnwindSafe,

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> 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,

§

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>,

§

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>,

§

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.