#[repr(C)]pub struct Badge {
pub string: AzString,
pub kind: BadgeKind,
pub badge_style: CssPropertyWithConditionsVec,
}Expand description
A small rounded pill showing a short status/count string. Stateless; renders a single styled text node.
Fields§
§string: AzStringThe text shown inside the pill.
kind: BadgeKindThe colour variant.
badge_style: CssPropertyWithConditionsVecThe computed inline style for the pill.
Implementations§
Source§impl Badge
impl Badge
Sourcepub fn create(string: AzString) -> Self
pub fn create(string: AzString) -> Self
Creates a new badge with the given text and the default (grey) kind.
Sourcepub fn with_kind(string: AzString, kind: BadgeKind) -> Self
pub fn with_kind(string: AzString, kind: BadgeKind) -> Self
Creates a new badge with the given text and colour variant.
Sourcepub fn with_badge_kind(self, kind: BadgeKind) -> Self
pub fn with_badge_kind(self, kind: BadgeKind) -> Self
Builder-style setter for the colour variant.
Sourcepub fn swap_with_default(&mut self) -> Self
pub fn swap_with_default(&mut self) -> Self
Replaces self with an empty default badge and returns the original.
Trait Implementations§
impl Eq for Badge
impl StructuralPartialEq for Badge
Auto Trait Implementations§
impl Freeze for Badge
impl RefUnwindSafe for Badge
impl Send for Badge
impl Sync for Badge
impl Unpin for Badge
impl UnsafeUnpin for Badge
impl UnwindSafe for Badge
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more