Struct MediaCardFace
pub struct MediaCardFace<'a> { /* private fields */ }Expand description
Immediate-mode media card.
Implementations§
§impl<'a> MediaCardFace<'a>
impl<'a> MediaCardFace<'a>
pub fn new(art: MediaArt<'a>) -> MediaCardFace<'a>
pub fn seed(self, name: &'a str) -> MediaCardFace<'a>
pub fn seed(self, name: &'a str) -> MediaCardFace<'a>
The name an art-only card’s placeholder takes its initials from (a photo’s place, an album’s name).
pub fn meta_mark(self, icon: Icon) -> MediaCardFace<'a>
pub fn meta_mark(self, icon: Icon) -> MediaCardFace<'a>
A mark after the first meta line: a verified channel, an explicit album.
pub fn aspect(self, aspect: MediaAspect) -> MediaCardFace<'a>
pub fn title(self, title: &'a str) -> MediaCardFace<'a>
pub fn title(self, title: &'a str) -> MediaCardFace<'a>
The title under the art, up to two lines. Without one the card is art only (a photo).
pub fn meta(self, line: &'a str) -> MediaCardFace<'a>
pub fn meta(self, line: &'a str) -> MediaCardFace<'a>
One secondary line (an artist, a channel, an author). Call twice for two lines (a channel, then “1.2M views”); never join facts with dots.
pub fn badges(self, badges: &'a [MediaBadge<'a>]) -> MediaCardFace<'a>
pub fn hover_action(self, icon: Icon) -> MediaCardFace<'a>
pub fn hover_action(self, icon: Icon) -> MediaCardFace<'a>
A centred action over the art while the card is hovered (Play).
pub fn selected(self, selected: bool) -> MediaCardFace<'a>
pub fn interaction(self, interaction: Interaction) -> MediaCardFace<'a>
pub fn creator(self, avatar: AvatarFace<'a>) -> MediaCardFace<'a>
pub fn creator(self, avatar: AvatarFace<'a>) -> MediaCardFace<'a>
Creator attribution beside the metadata, using the shared avatar painter.
pub fn text_height(
&self,
text: &mut TextRenderer,
theme: &Theme,
width: f64,
) -> f64
pub fn text_height( &self, text: &mut TextRenderer, theme: &Theme, width: f64, ) -> f64
The height of the text block under the art at width (0 for an
art-only card). A grid passes the tallest of a row to every card in
it, so their titles line up.
pub fn height(&self, text: &mut TextRenderer, theme: &Theme, width: f64) -> f64
pub fn height(&self, text: &mut TextRenderer, theme: &Theme, width: f64) -> f64
The card’s total height at width, with its own text block.
pub fn hover_action_rect(&self, rect: Rect, theme: &Theme) -> Option<Rect>
pub fn hover_action_rect(&self, rect: Rect, theme: &Theme) -> Option<Rect>
Where the hover action sits, when the card shows one.
pub fn paint(&self, ctx: &mut PaintCtx<'_>, rect: Rect)
pub fn paint(&self, ctx: &mut PaintCtx<'_>, rect: Rect)
Paint the card into rect: the art at the top, the text under it.
pub fn accessibility(&self, rect: Rect) -> AccessNode
pub fn accessibility(&self, rect: Rect) -> AccessNode
The card’s accessibility node: named by its title, valued by its meta lines and badges.
Trait Implementations§
§impl<'a> Clone for MediaCardFace<'a>
impl<'a> Clone for MediaCardFace<'a>
§fn clone(&self) -> MediaCardFace<'a>
fn clone(&self) -> MediaCardFace<'a>
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more§impl<'a> Debug for MediaCardFace<'a>
impl<'a> Debug for MediaCardFace<'a>
impl<'a> Copy for MediaCardFace<'a>
Auto Trait Implementations§
impl<'a> Freeze for MediaCardFace<'a>
impl<'a> !RefUnwindSafe for MediaCardFace<'a>
impl<'a> !Send for MediaCardFace<'a>
impl<'a> !Sync for MediaCardFace<'a>
impl<'a> Unpin for MediaCardFace<'a>
impl<'a> UnsafeUnpin for MediaCardFace<'a>
impl<'a> !UnwindSafe for MediaCardFace<'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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§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.§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.§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.§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.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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