pub struct Avatar { /* private fields */ }Expand description
A user picture. Without src, or when the image fails to load, it shows
the initials of name.
let html = render_static(Avatar![name = "Ada Lovelace", size = Size::Lg, bordered = true]);
assert!(html.contains(r#"<span class="nr-avatar-fallback" aria-hidden="true">AL</span>"#));Implementations§
Source§impl Avatar
impl Avatar
pub fn new() -> Self
Sourcepub fn class(self, v: impl Into<String>) -> Self
pub fn class(self, v: impl Into<String>) -> Self
Extra classes for the outer element. They win over the defaults.
Sourcepub fn with(self, part: impl Part) -> Self
pub fn with(self, part: impl Part) -> Self
Add an attribute to the outer element, or content shown instead of the initials (an icon).
Sourcepub fn name(self, v: impl Into<String>) -> Self
pub fn name(self, v: impl Into<String>) -> Self
The person’s name: the image’s alt text and the source of the initials.
Sourcepub fn initials(self, v: impl Into<String>) -> Self
pub fn initials(self, v: impl Into<String>) -> Self
Text shown without an image (defaults to the initials of name).
pub fn size(self, v: Size) -> Self
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Avatar
impl !Sync for Avatar
impl !UnwindSafe for Avatar
impl Forget for Avatar
impl Freeze for Avatar
impl Move for Avatar
impl Send for Avatar
impl Unpin for Avatar
impl UnsafeUnpin 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