Struct Summary
pub struct Summary {Show 14 fields
pub id: String,
pub kind: Kind,
pub title: String,
pub subtitle: String,
pub icon: String,
pub source: String,
pub value: String,
pub countdown: Option<i64>,
pub progress: Option<f32>,
pub length: Option<u64>,
pub artwork: String,
pub art: Art,
pub tone: Tone,
pub controls: Vec<Control>,
}Expand description
One activity, as the bar’s pill and the floating layer draw it.
Fields§
§id: StringThe activity’s own id, stable while it runs: the same timer or call keeps its id across frames, so a card keeps its place and its dismissal.
kind: Kind§title: StringWhat it is, in the app’s words: “Tea”, “Ada”, “9th Street”.
subtitle: StringThe line under it: the artist of a song, who is speaking, the street the directions turn onto.
icon: StringThe app’s own glyph, by lucide name (“timer”, “music”): a card’s header shows it, so a glance says which app the activity is.
source: StringThe app the activity belongs to, as the person knows it (“Music”, “Clocks”): a card’s header says it beside the app’s glyph. The session that shows the activity fills it, so it is named in the person’s language and never as an id.
value: StringWhat it reads now: “4:32”, “2 min”, “muted”.
countdown: Option<i64>What is left, in seconds, for a countdown: a timer due sooner stands ahead of one that is not.
progress: Option<f32>How far along it is, from 0 to 1, when it has a length.
length: Option<u64>How long what it plays runs, in seconds: with progress, a card says
where the song is and what is left of it.
artwork: StringIts artwork, by picture address (a content address, or a data:
picture): a card shows it beside the title, the pill’s a thumbnail.
art: ArtHow the artwork heads the card: beside the lines, or over them.
tone: Tone§controls: Vec<Control>Implementations§
§impl Summary
impl Summary
pub fn new(
kind: Kind,
title: impl Into<String>,
value: impl Into<String>,
) -> Summary
pub fn new( kind: Kind, title: impl Into<String>, value: impl Into<String>, ) -> Summary
An activity of kind called title, reading value.
pub fn with_subtitle(self, subtitle: impl Into<String>) -> Summary
pub fn with_subtitle(self, subtitle: impl Into<String>) -> Summary
The line under the title: the artist, the speaker, the street.
pub fn with_source(self, source: impl Into<String>) -> Summary
pub fn with_source(self, source: impl Into<String>) -> Summary
The app it belongs to, as the person knows it: a card’s header says it beside the app’s glyph.
pub fn glyph(&self) -> &str
pub fn glyph(&self) -> &str
The glyph a card’s header shows: the app’s own, or the one its kind stands for.
pub fn with_id(self, id: impl Into<String>) -> Summary
pub fn with_countdown(self, seconds: i64) -> Summary
pub fn with_progress(self, progress: f32) -> Summary
pub fn with_length(self, seconds: u64) -> Summary
pub fn with_length(self, seconds: u64) -> Summary
How long it runs, in seconds, so a card can say where it is and what is left of it.
pub fn with_artwork(self, artwork: impl Into<String>) -> Summary
pub fn with_artwork(self, artwork: impl Into<String>) -> Summary
The artwork it shows, by picture address.
pub fn with_hero_artwork(self, artwork: impl Into<String>) -> Summary
pub fn with_hero_artwork(self, artwork: impl Into<String>) -> Summary
The artwork heads the card over its lines, at nine sixteenths of the card’s width: a picture the activity made is shown whole, not as a tile beside a title.
pub fn elapsed_seconds(&self) -> Option<u64>
pub fn elapsed_seconds(&self) -> Option<u64>
Where the activity stands in what it runs, in seconds, from how far
along it is: None when it has no length.
pub fn remaining_seconds(&self) -> Option<u64>
pub fn remaining_seconds(&self) -> Option<u64>
What is left of it, in seconds, when it has a length.
pub fn with_tone(self, tone: Tone) -> Summary
pub fn with_control(self, control: Control) -> Summary
pub fn reading(&self) -> String
pub fn reading(&self) -> String
The words the pill and a card’s header say: the title, and its reading when it has one.
pub fn hero(&self) -> &str
pub fn hero(&self) -> &str
What a card shows largest: the reading when it has one, else the title. A timer’s countdown is what a glance is after; a song has no countdown, and its track is.
pub fn header_title(&self) -> Option<&str>
pub fn header_title(&self) -> Option<&str>
The title a card’s header says above its hero, when the hero is not the title itself.
pub fn header_line(&self) -> &str
pub fn header_line(&self) -> &str
What a card’s header says beside the app’s glyph: the title, when the hero is the card’s reading, else the app the activity belongs to.
pub fn pill_rank(&self) -> (u8, i64, &str)
pub fn pill_rank(&self) -> (u8, i64, &str)
Where this activity stands in the pill: its kind first, then a timer that is due within a minute, then what it has left, then its id, so the order never depends on the order the board was read in.
pub fn first_control(&self) -> Option<&Control>
pub fn first_control(&self) -> Option<&Control>
The control a plain press (Space, a click on the card) runs: the first one the app marked primary, else its first.
pub fn close_control(&self) -> Option<&Control>
pub fn close_control(&self) -> Option<&Control>
The control that ends the activity, when the app offers one.
pub fn has_actions(&self) -> bool
pub fn has_actions(&self) -> bool
Whether the card draws a row of offered controls: every control but the close, which its header carries instead.
pub fn action_controls(&self) -> Vec<&Control>
pub fn action_controls(&self) -> Vec<&Control>
The controls the card’s row draws, in the order the app named them: everything but the close, which the card’s header carries instead.
pub fn transport(&self) -> Option<Vec<(&str, TransportControl)>>
pub fn transport(&self) -> Option<Vec<(&str, TransportControl)>>
The activity’s offered controls as a media transport, when every one of them is the transport’s — previous, play/pause, next: the card then paints them the one way every media surface paints a transport, by id.
Trait Implementations§
§impl<'de> Deserialize<'de> for Summary
impl<'de> Deserialize<'de> for Summary
§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Summary, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Summary, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
§impl Serialize for Summary
impl Serialize for Summary
§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Summary
Auto Trait Implementations§
impl Freeze for Summary
impl RefUnwindSafe for Summary
impl Send for Summary
impl Sync for Summary
impl Unpin for Summary
impl UnsafeUnpin for Summary
impl UnwindSafe for Summary
Blanket Implementations§
§impl<T> AnyEq for T
impl<T> AnyEq for T
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> 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>, which can then be
downcast into Box<dyn 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>, which 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> DowncastSend for T
impl<T> DowncastSend for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§impl<T> DowncastSync for T
impl<T> DowncastSync for T
§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