#[repr(C)]pub struct Avatar {
pub image: OptionImageRef,
pub initials: AzString,
pub size: AvatarSize,
pub avatar_style: CssPropertyWithConditionsVec,
}Expand description
A circular avatar showing an image or initials. Stateless.
Fields§
§image: OptionImageRefOptional image; when present it is shown instead of the initials.
initials: AzStringFallback initials shown when no image is set.
size: AvatarSizeThe size variant.
avatar_style: CssPropertyWithConditionsVecThe computed inline style for the circular container.
Implementations§
Source§impl Avatar
impl Avatar
Sourcepub fn create(initials: AzString) -> Self
pub fn create(initials: AzString) -> Self
Creates a medium initials avatar with the given text.
Sourcepub fn create_with_image(image: ImageRef) -> Self
pub fn create_with_image(image: ImageRef) -> Self
Creates a medium image avatar (with empty fallback initials).
Sourcepub fn set_image(&mut self, image: ImageRef)
pub fn set_image(&mut self, image: ImageRef)
Sets the avatar image (shown instead of the initials).
Sourcepub fn with_image(self, image: ImageRef) -> Self
pub fn with_image(self, image: ImageRef) -> Self
Builder-style setter for the avatar image.
Sourcepub fn set_size(&mut self, size: AvatarSize)
pub fn set_size(&mut self, size: AvatarSize)
Sets the size variant, recomputing the style.
Sourcepub fn with_size(self, size: AvatarSize) -> Self
pub fn with_size(self, size: AvatarSize) -> Self
Builder-style setter for the size variant.
Sourcepub fn swap_with_default(&mut self) -> Self
pub fn swap_with_default(&mut self) -> Self
Replaces self with a default (empty medium) avatar and returns the original.
Trait Implementations§
impl Eq for Avatar
impl StructuralPartialEq for Avatar
Auto Trait Implementations§
impl Freeze for Avatar
impl RefUnwindSafe for Avatar
impl Send for Avatar
impl Sync for Avatar
impl Unpin for Avatar
impl UnsafeUnpin for Avatar
impl UnwindSafe for Avatar
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