pub struct BorderRadius {
pub top_left: f32,
pub top_right: f32,
pub bottom_right: f32,
pub bottom_left: f32,
}Expand description
Corner radii, per corner (logical px). From<f32> covers the uniform case:
anywhere a radius is expected, a plain 10.0 still works.
Fields§
§top_left: f32The top-left corner’s radius, in logical pixels.
top_right: f32The top-right corner’s radius, in logical pixels.
bottom_right: f32The bottom-right corner’s radius, in logical pixels.
bottom_left: f32The bottom-left corner’s radius, in logical pixels.
Implementations§
Source§impl BorderRadius
impl BorderRadius
Sourcepub const ZERO: BorderRadius
pub const ZERO: BorderRadius
No rounding at all.
Sourcepub fn lerp(self, other: BorderRadius, t: f32) -> BorderRadius
pub fn lerp(self, other: BorderRadius, t: f32) -> BorderRadius
Each corner t of the way from self to other.
Not clamped: a corner past its target is what a spring asks for at the end of its travel, and the one rule for a radius in flight is this one — an animated container and a decoration transition both go through it.
Sourcepub const fn uniform(radius: f32) -> BorderRadius
pub const fn uniform(radius: f32) -> BorderRadius
The same radius on all four corners.
Sourcepub const fn top(radius: f32) -> BorderRadius
pub const fn top(radius: f32) -> BorderRadius
Only the top corners rounded (headers, rising sheets).
Sourcepub const fn bottom(radius: f32) -> BorderRadius
pub const fn bottom(radius: f32) -> BorderRadius
Only the bottom corners rounded.
Sourcepub const fn left(radius: f32) -> BorderRadius
pub const fn left(radius: f32) -> BorderRadius
Only the left corners rounded.
Sourcepub const fn right(radius: f32) -> BorderRadius
pub const fn right(radius: f32) -> BorderRadius
Sourcepub fn clamped(self) -> BorderRadius
pub fn clamped(self) -> BorderRadius
Radii clamped at zero — a negative radius is meaningless when painting.
Sourcepub fn inflate(self, by: f32) -> BorderRadius
pub fn inflate(self, by: f32) -> BorderRadius
Every corner grown by by — the envelope of a blurred shadow.
Sourcepub fn scale(self, factor: f32) -> BorderRadius
pub fn scale(self, factor: f32) -> BorderRadius
Every radius multiplied by factor (DPI scaling).
Trait Implementations§
Source§impl Clone for BorderRadius
impl Clone for BorderRadius
Source§fn clone(&self) -> BorderRadius
fn clone(&self) -> BorderRadius
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for BorderRadius
Source§impl Debug for BorderRadius
impl Debug for BorderRadius
Source§impl Default for BorderRadius
impl Default for BorderRadius
Source§fn default() -> BorderRadius
fn default() -> BorderRadius
Source§impl From<f32> for BorderRadius
impl From<f32> for BorderRadius
Source§fn from(radius: f32) -> BorderRadius
fn from(radius: f32) -> BorderRadius
Source§impl Lerp for BorderRadius
impl Lerp for BorderRadius
Source§fn lerp(self, other: BorderRadius, t: f32) -> BorderRadius
fn lerp(self, other: BorderRadius, t: f32) -> BorderRadius
self (at t=0) to other (at t=1).Source§impl PartialEq for BorderRadius
impl PartialEq for BorderRadius
impl StructuralPartialEq for BorderRadius
Auto Trait Implementations§
impl Freeze for BorderRadius
impl RefUnwindSafe for BorderRadius
impl Send for BorderRadius
impl Sync for BorderRadius
impl Unpin for BorderRadius
impl UnsafeUnpin for BorderRadius
impl UnwindSafe for BorderRadius
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can
then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be
further downcast into Rc<ConcreteType> where ConcreteType implements Trait.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &Any’s vtable from &Trait’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot
generate &mut Any’s vtable from &mut Trait’s.