pub struct ProfileCard<'a> { /* private fields */ }Expand description
A profile card that embeds in any layout and sends follow requests to the directory’s
Profiles service. Details and follow state stay host-owned.
Nothing is cached in the card, so replacing the directory’s service clears what it shows.
Handle NotificationsAction::OpenProfile by selecting its profile in the host’s layout, then
call show for it. Keep polling the directory every frame, including while
the card is hidden. Install an egui image loader to display host-provided avatar URIs.
use egui_charts::services::{ProfileDirectory, ProfileId};
use egui_charts::ui::profile::ProfileCard;
let mut directory = ProfileDirectory::new(); // Attach the host with set_service.
let selected = ProfileId("ada".into());
directory.poll(ui.ctx());
ProfileCard::new(&selected).show(ui, &mut directory);Implementations§
Source§impl<'a> ProfileCard<'a>
impl<'a> ProfileCard<'a>
Sourcepub fn new(id: &'a ProfileId) -> Self
pub fn new(id: &'a ProfileId) -> Self
Shows the profile with this host identifier, or an unavailable state until it is pushed.
Sourcepub fn show(self, ui: &mut Ui, directory: &mut ProfileDirectory)
pub fn show(self, ui: &mut Ui, directory: &mut ProfileDirectory)
Draws the latest details, follow control and any pending request or host failure. A failed request keeps the reported follow state and may be retried or dismissed.
Auto Trait Implementations§
impl<'a> Freeze for ProfileCard<'a>
impl<'a> RefUnwindSafe for ProfileCard<'a>
impl<'a> Send for ProfileCard<'a>
impl<'a> Sync for ProfileCard<'a>
impl<'a> Unpin for ProfileCard<'a>
impl<'a> UnsafeUnpin for ProfileCard<'a>
impl<'a> UnwindSafe for ProfileCard<'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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