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 Format for CornerRadii
impl Format for CornerRadii
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<CornerRadii> for CornerRadii
impl PartialEq<CornerRadii> for CornerRadii
source§fn eq(&self, other: &CornerRadii) -> bool
fn eq(&self, other: &CornerRadii) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<CornerRadii> for CornerRadii
impl PartialOrd<CornerRadii> for CornerRadii
source§fn partial_cmp(&self, other: &CornerRadii) -> Option<Ordering>
fn partial_cmp(&self, other: &CornerRadii) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for CornerRadii
impl Eq for CornerRadii
impl StructuralEq for CornerRadii
impl StructuralPartialEq for CornerRadii
Auto Trait Implementations§
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<Src, Dst> LosslessTryInto<Dst> for Srcwhere
Dst: LosslessTryFrom<Src>,
impl<Src, Dst> LosslessTryInto<Dst> for Srcwhere Dst: LosslessTryFrom<Src>,
source§fn lossless_try_into(self) -> Option<Dst>
fn lossless_try_into(self) -> Option<Dst>
Performs the conversion.
source§impl<Src, Dst> LossyInto<Dst> for Srcwhere
Dst: LossyFrom<Src>,
impl<Src, Dst> LossyInto<Dst> for Srcwhere Dst: LossyFrom<Src>,
source§fn lossy_into(self) -> Dst
fn lossy_into(self) -> Dst
Performs the conversion.
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.
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self
from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self
is actually part of its subset T
(and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset
but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self
to the equivalent element of its superset.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.