i_slint_core

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

Source§

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,

Source§

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,

Source§

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,

Source§

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,

Source§

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

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

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

Source§

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> CloneToUninit for T
where T: Clone,

Source§

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

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. 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.