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 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 for CornerRadiiBuilder
impl PartialEq for CornerRadiiBuilder
source§impl PartialOrd for CornerRadiiBuilder
impl PartialOrd for CornerRadiiBuilder
impl Copy for CornerRadiiBuilder
impl Eq for CornerRadiiBuilder
impl StructuralPartialEq for CornerRadiiBuilder
Auto Trait Implementations§
impl Freeze for CornerRadiiBuilder
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<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.