pub struct CornerRadii {
pub top_left: Size,
pub top_right: Size,
pub bottom_right: Size,
pub bottom_left: Size,
}
Expand description
The definition of each corner radius for a rounded rectangle.
§Examples
§Create a radii configuration with equal corners
This example create a CornerRadii
instance where each corner has an equal, elliptical radius
of 10px x 8px.
use embedded_graphics::{geometry::Size, primitives::CornerRadii};
let radii = CornerRadii::new(Size::new(10, 8));
assert_eq!(
radii,
CornerRadii {
top_left: Size::new(10, 8),
top_right: Size::new(10, 8),
bottom_right: Size::new(10, 8),
bottom_left: Size::new(10, 8),
}
);
Fields§
§top_left: Size
Top left corner radius
top_right: Size
Top right corner radius
bottom_right: Size
Bottom right corner radius
bottom_left: Size
Bottom left corner radius
Implementations§
source§impl CornerRadii
impl CornerRadii
sourcepub const fn new(radius: Size) -> Self
pub const fn new(radius: Size) -> Self
Create a new set of corner radii with all corners having equal values.
To create a CornerRadii
instance with different radii for each corner, use the
CornerRadiiBuilder
builder.
Trait Implementations§
source§impl Clone for CornerRadii
impl Clone for CornerRadii
source§fn clone(&self) -> CornerRadii
fn clone(&self) -> CornerRadii
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Debug for CornerRadii
impl Debug for CornerRadii
source§impl Default for CornerRadii
impl Default for CornerRadii
source§fn default() -> CornerRadii
fn default() -> CornerRadii
Returns the “default value” for a type. Read more
source§impl From<&CornerRadii> for CornerRadiiBuilder
impl From<&CornerRadii> for CornerRadiiBuilder
source§fn from(corners: &CornerRadii) -> Self
fn from(corners: &CornerRadii) -> Self
Converts to this type from the input type.
source§impl Hash for CornerRadii
impl Hash for CornerRadii
source§impl Ord for CornerRadii
impl Ord for CornerRadii
source§fn cmp(&self, other: &CornerRadii) -> Ordering
fn cmp(&self, other: &CornerRadii) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for CornerRadii
impl PartialEq for CornerRadii
source§impl PartialOrd for CornerRadii
impl PartialOrd for CornerRadii
impl Copy for CornerRadii
impl Eq for CornerRadii
impl StructuralPartialEq for CornerRadii
Auto Trait Implementations§
impl Freeze for CornerRadii
impl RefUnwindSafe for CornerRadii
impl Send for CornerRadii
impl Sync for CornerRadii
impl Unpin for CornerRadii
impl UnwindSafe for CornerRadii
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CheckedAs for T
impl<T> CheckedAs for T
source§fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
fn checked_as<Dst>(self) -> Option<Dst>where
T: CheckedCast<Dst>,
Casts the value.
source§impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
impl<Src, Dst> CheckedCastFrom<Src> for Dstwhere
Src: CheckedCast<Dst>,
source§fn checked_cast_from(src: Src) -> Option<Dst>
fn checked_cast_from(src: Src) -> Option<Dst>
Casts the value.
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)source§impl<T> OverflowingAs for T
impl<T> OverflowingAs for T
source§fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
fn overflowing_as<Dst>(self) -> (Dst, bool)where
T: OverflowingCast<Dst>,
Casts the value.
source§impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
impl<Src, Dst> OverflowingCastFrom<Src> for Dstwhere
Src: OverflowingCast<Dst>,
source§fn overflowing_cast_from(src: Src) -> (Dst, bool)
fn overflowing_cast_from(src: Src) -> (Dst, bool)
Casts the value.
source§impl<T> SaturatingAs for T
impl<T> SaturatingAs for T
source§fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
fn saturating_as<Dst>(self) -> Dstwhere
T: SaturatingCast<Dst>,
Casts the value.
source§impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
impl<Src, Dst> SaturatingCastFrom<Src> for Dstwhere
Src: SaturatingCast<Dst>,
source§fn saturating_cast_from(src: Src) -> Dst
fn saturating_cast_from(src: Src) -> Dst
Casts the value.
source§impl<T> UnwrappedAs for T
impl<T> UnwrappedAs for T
source§fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
fn unwrapped_as<Dst>(self) -> Dstwhere
T: UnwrappedCast<Dst>,
Casts the value.
source§impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
impl<Src, Dst> UnwrappedCastFrom<Src> for Dstwhere
Src: UnwrappedCast<Dst>,
source§fn unwrapped_cast_from(src: Src) -> Dst
fn unwrapped_cast_from(src: Src) -> Dst
Casts the value.
source§impl<T> WrappingAs for T
impl<T> WrappingAs for T
source§fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
fn wrapping_as<Dst>(self) -> Dstwhere
T: WrappingCast<Dst>,
Casts the value.
source§impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
impl<Src, Dst> WrappingCastFrom<Src> for Dstwhere
Src: WrappingCast<Dst>,
source§fn wrapping_cast_from(src: Src) -> Dst
fn wrapping_cast_from(src: Src) -> Dst
Casts the value.