Enum Author
pub enum Author<'a> {
Person {
name: &'a str,
identity: &'a str,
avatar: Option<&'a ImageData>,
color: Option<AlphaColor<Srgb>>,
},
Agent {
name: &'a str,
for_person: Option<&'a str>,
color: AlphaColor<Srgb>,
},
Bot {
bot_name: &'a str,
installed_by: &'a str,
appearance: Option<&'a Appearance>,
linked: Option<&'a str>,
image: Option<&'a ImageData>,
},
}Expand description
Who an item is by.
Variants§
Person
A person, by name and identity (which picks their colour), with the picture they set, already decoded by the app’s image store.
Fields
color: Option<AlphaColor<Srgb>>Agent
An agent acting for a person.
Bot
An installed bot, by its name and installer, with the appearance it showed, the Tilo person its persona is linked to, and the image its tile shows (the appearance’s avatar, else the bot’s icon).
Implementations§
§impl<'a> Author<'a>
impl<'a> Author<'a>
pub fn shown_name(&self) -> &'a str
pub fn shown_name(&self) -> &'a str
The name the author is shown under.
pub fn is_bot(&self) -> bool
pub fn label(&self, members: &[&str]) -> String
pub fn label(&self, members: &[&str]) -> String
The shown name among the room’s current members: a bot’s
appearance that looks like one of them carries its persona’s service
(or, without one, the bot’s name).
pub fn details(&self) -> Option<String>
pub fn details(&self) -> Option<String>
What the chip says about a bot: the name it showed, the bot and who added it.
pub fn linked_line(&self) -> Option<String>
pub fn linked_line(&self) -> Option<String>
The profile line for a persona linked to a Tilo person; the author is still the bot.
pub fn layout(
&self,
members: &[&str],
origin: Point,
max_width: f64,
text: &mut TextRenderer,
theme: &Theme,
) -> AuthorLine
pub fn layout( &self, members: &[&str], origin: Point, max_width: f64, text: &mut TextRenderer, theme: &Theme, ) -> AuthorLine
Lay the author out in one line from origin, at most max_width
wide. A bot’s chip is placed first, so only the name gives way.
pub fn paint(&self, line: &AuthorLine, ctx: &mut PaintCtx<'_>)
pub fn paint(&self, line: &AuthorLine, ctx: &mut PaintCtx<'_>)
Paint a line Self::layout placed.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Author<'a>
impl<'a> !RefUnwindSafe for Author<'a>
impl<'a> Send for Author<'a>
impl<'a> Sync for Author<'a>
impl<'a> Unpin for Author<'a>
impl<'a> UnsafeUnpin for Author<'a>
impl<'a> !UnwindSafe for Author<'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> 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