pub struct CornerRadiiBuilder { /* private fields */ }
Expand description
CornerRadii
builder.
Implementations§
source§impl CornerRadiiBuilder
impl CornerRadiiBuilder
sourcepub const fn new() -> Self
pub const fn new() -> Self
Create a new corner radii builder.
All radii are defaulted to 0px x 0px.
sourcepub const fn all(self, radius: Size) -> Self
pub const fn all(self, radius: Size) -> Self
Set all corner radii to the same value.
Examples
use embedded_graphics::{
geometry::Size,
primitives::{CornerRadii, CornerRadiiBuilder},
};
let corners = CornerRadiiBuilder::new().all(Size::new(10, 20)).build();
assert_eq!(
corners,
CornerRadii {
top_left: Size::new(10, 20),
top_right: Size::new(10, 20),
bottom_right: Size::new(10, 20),
bottom_left: Size::new(10, 20),
}
);
sourcepub const fn top(self, radius: Size) -> Self
pub const fn top(self, radius: Size) -> Self
Set the top left and top right corner radii to the same value.
Examples
use embedded_graphics::{
geometry::Size,
primitives::{CornerRadii, CornerRadiiBuilder},
};
let corners = CornerRadiiBuilder::new().top(Size::new(10, 20)).build();
assert_eq!(
corners,
CornerRadii {
top_left: Size::new(10, 20),
top_right: Size::new(10, 20),
bottom_right: Size::zero(),
bottom_left: Size::zero(),
}
);
sourcepub const fn right(self, radius: Size) -> Self
pub const fn right(self, radius: Size) -> Self
Set the top right and bottom right corner radii to the same value.
Examples
use embedded_graphics::{
geometry::Size,
primitives::{CornerRadii, CornerRadiiBuilder},
};
let corners = CornerRadiiBuilder::new().right(Size::new(10, 20)).build();
assert_eq!(
corners,
CornerRadii {
top_left: Size::zero(),
top_right: Size::new(10, 20),
bottom_right: Size::new(10, 20),
bottom_left: Size::zero(),
}
);
sourcepub const fn bottom(self, radius: Size) -> Self
pub const fn bottom(self, radius: Size) -> Self
Set the bottom left and bottom right corner radii to the same value.
Examples
use embedded_graphics::{
geometry::Size,
primitives::{CornerRadii, CornerRadiiBuilder},
};
let corners = CornerRadiiBuilder::new().bottom(Size::new(10, 20)).build();
assert_eq!(
corners,
CornerRadii {
top_left: Size::zero(),
top_right: Size::zero(),
bottom_right: Size::new(10, 20),
bottom_left: Size::new(10, 20),
}
);
sourcepub const fn left(self, radius: Size) -> Self
pub const fn left(self, radius: Size) -> Self
Set the top left and bottom left corner radii to the same value.
Examples
use embedded_graphics::{
geometry::Size,
primitives::{CornerRadii, CornerRadiiBuilder},
};
let corners = CornerRadiiBuilder::new().left(Size::new(10, 20)).build();
assert_eq!(
corners,
CornerRadii {
top_left: Size::new(10, 20),
top_right: Size::zero(),
bottom_right: Size::zero(),
bottom_left: Size::new(10, 20),
}
);
sourcepub const fn top_left(self, radius: Size) -> Self
pub const fn top_left(self, radius: Size) -> Self
Set the top left corner radius.
Examples
use embedded_graphics::{
geometry::Size,
primitives::{CornerRadii, CornerRadiiBuilder},
};
let corners = CornerRadiiBuilder::new()
.top_left(Size::new(10, 20))
.build();
assert_eq!(
corners,
CornerRadii {
top_left: Size::new(10, 20),
top_right: Size::zero(),
bottom_right: Size::zero(),
bottom_left: Size::zero(),
}
);
sourcepub const fn top_right(self, radius: Size) -> Self
pub const fn top_right(self, radius: Size) -> Self
Set the top right corner radius.
Examples
use embedded_graphics::{
geometry::Size,
primitives::{CornerRadii, CornerRadiiBuilder},
};
let corners = CornerRadiiBuilder::new()
.top_right(Size::new(10, 20))
.build();
assert_eq!(
corners,
CornerRadii {
top_left: Size::zero(),
top_right: Size::new(10, 20),
bottom_right: Size::zero(),
bottom_left: Size::zero(),
}
);
sourcepub const fn bottom_right(self, radius: Size) -> Self
pub const fn bottom_right(self, radius: Size) -> Self
Set the bottom right corner radius.
Examples
use embedded_graphics::{
geometry::Size,
primitives::{CornerRadii, CornerRadiiBuilder},
};
let corners = CornerRadiiBuilder::new()
.bottom_right(Size::new(10, 20))
.build();
assert_eq!(
corners,
CornerRadii {
top_left: Size::zero(),
top_right: Size::zero(),
bottom_right: Size::new(10, 20),
bottom_left: Size::zero(),
}
);
sourcepub const fn bottom_left(self, radius: Size) -> Self
pub const fn bottom_left(self, radius: Size) -> Self
Set the bottom left corner radius.
Examples
use embedded_graphics::{
geometry::Size,
primitives::{CornerRadii, CornerRadiiBuilder},
};
let corners = CornerRadiiBuilder::new()
.bottom_left(Size::new(10, 20))
.build();
assert_eq!(
corners,
CornerRadii {
top_left: Size::zero(),
top_right: Size::zero(),
bottom_right: Size::zero(),
bottom_left: Size::new(10, 20),
}
);
sourcepub const fn build(self) -> CornerRadii
pub const fn build(self) -> CornerRadii
Consume the builder and produce a CornerRadii
configuration.
Trait Implementations§
source§impl Clone for CornerRadiiBuilder
impl Clone for CornerRadiiBuilder
source§fn clone(&self) -> CornerRadiiBuilder
fn clone(&self) -> CornerRadiiBuilder
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 CornerRadiiBuilder
impl Debug for CornerRadiiBuilder
source§impl Default for CornerRadiiBuilder
impl Default for CornerRadiiBuilder
source§fn default() -> CornerRadiiBuilder
fn default() -> CornerRadiiBuilder
Returns the “default value” for a type. Read more
source§impl Format for CornerRadiiBuilder
impl Format for CornerRadiiBuilder
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 CornerRadiiBuilder
impl Hash for CornerRadiiBuilder
source§impl Ord for CornerRadiiBuilder
impl Ord for CornerRadiiBuilder
source§fn cmp(&self, other: &CornerRadiiBuilder) -> Ordering
fn cmp(&self, other: &CornerRadiiBuilder) -> 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<CornerRadiiBuilder> for CornerRadiiBuilder
impl PartialEq<CornerRadiiBuilder> for CornerRadiiBuilder
source§fn eq(&self, other: &CornerRadiiBuilder) -> bool
fn eq(&self, other: &CornerRadiiBuilder) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<CornerRadiiBuilder> for CornerRadiiBuilder
impl PartialOrd<CornerRadiiBuilder> for CornerRadiiBuilder
source§fn partial_cmp(&self, other: &CornerRadiiBuilder) -> Option<Ordering>
fn partial_cmp(&self, other: &CornerRadiiBuilder) -> 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 CornerRadiiBuilder
impl Eq for CornerRadiiBuilder
impl StructuralEq for CornerRadiiBuilder
impl StructuralPartialEq for CornerRadiiBuilder
Auto Trait Implementations§
impl RefUnwindSafe for CornerRadiiBuilder
impl Send for CornerRadiiBuilder
impl Sync for CornerRadiiBuilder
impl Unpin for CornerRadiiBuilder
impl UnwindSafe for CornerRadiiBuilder
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.