pub struct ChatMessage { /* private fields */ }Expand description
One message of a Chat.
Implementations§
Source§impl ChatMessage
impl ChatMessage
Sourcepub fn person(text: impl Into<String>) -> ChatMessage
pub fn person(text: impl Into<String>) -> ChatMessage
What the person wrote.
Sourcepub fn assistant(text: impl Into<String>) -> ChatMessage
pub fn assistant(text: impl Into<String>) -> ChatMessage
What the assistant answered.
Sourcepub fn assistant_writing(text: Arc<Mutex<String>>) -> ChatMessage
pub fn assistant_writing(text: Arc<Mutex<String>>) -> ChatMessage
What the assistant is still answering. Whoever answers writes to text, from
any thread, and asks for a rebuild with a UiWaker. While it
is empty, the message shows that it is on its way.
Sourcepub fn media(self, media: ChatMedia) -> ChatMessage
pub fn media(self, media: ChatMedia) -> ChatMessage
A photo, a document or a recording in the bubble, above the text, which may be empty.
Sourcepub fn formatted(self) -> ChatMessage
pub fn formatted(self) -> ChatMessage
Reads its text as a RichText, with marks and links.
Sourcepub fn card(self, card: impl Fn() -> Box<dyn View> + 'static) -> ChatMessage
pub fn card(self, card: impl Fn() -> Box<dyn View> + 'static) -> ChatMessage
Something to act on under the text, such as buttons. It is built each time the message is shown.
Who wrote it.
Trait Implementations§
Source§impl Clone for ChatMessage
impl Clone for ChatMessage
Source§fn clone(&self) -> ChatMessage
fn clone(&self) -> ChatMessage
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for ChatMessage
impl !Send for ChatMessage
impl !Sync for ChatMessage
impl !UnwindSafe for ChatMessage
impl Freeze for ChatMessage
impl Unpin for ChatMessage
impl UnsafeUnpin for ChatMessage
Blanket Implementations§
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
impl<T> AutoreleaseSafe for Twhere
T: ?Sized,
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