pub struct MessageBuilder<'a, C: 'a + ?Sized, M = TextKind> { /* private fields */ }Expand description
An awaitable message builder(await sends the message)
Implementations§
Source§impl<'a, C, M> MessageBuilder<'a, C, M>
impl<'a, C, M> MessageBuilder<'a, C, M>
pub fn live_message(self) -> Self
pub fn with_ttl(self, ttl: Duration) -> Self
pub fn reply_to(self, msg_id: impl Into<MessageId>) -> Self
pub fn set_text(self, text: impl Into<String>) -> Self
Sourcepub fn send(self) -> <Self as IntoFuture>::IntoFuturewhere
Self: IntoFuture,
pub fn send(self) -> <Self as IntoFuture>::IntoFuturewhere
Self: IntoFuture,
A syntactic sugar to avoid double awaits(.await.await -> .await.send().await) in
certain use-cases
Source§impl<'a, C> MessageBuilder<'a, C, TextKind>
impl<'a, C> MessageBuilder<'a, C, TextKind>
pub fn with_image(self, img: Image) -> MessageBuilder<'a, C, PreviewableKind>
pub fn with_video(self, vid: Video) -> MessageBuilder<'a, C, PreviewableKind>
pub fn with_link(self, link: Link) -> MessageBuilder<'a, C, PreviewableKind>
pub fn attach(self, img: CryptoFile) -> MessageBuilder<'a, C, RichKind>
pub fn report(self, reason: ReportReason) -> MessageBuilder<'a, C, RichKind>
pub fn link_chat(self, chat: Chat) -> MessageBuilder<'a, C, RichKind>
Source§impl<'a, C> MessageBuilder<'a, C, RichKind>
impl<'a, C> MessageBuilder<'a, C, RichKind>
pub fn set_file_source(self, source: CryptoFile) -> Self
Source§impl<'a, C> MessageBuilder<'a, C, PreviewableKind>
impl<'a, C> MessageBuilder<'a, C, PreviewableKind>
Sourcepub fn with_preview(self, preview: ImagePreview) -> Self
pub fn with_preview(self, preview: ImagePreview) -> Self
Override the current image preview with a custom one
Trait Implementations§
Source§impl<'a, C, M> IntoFuture for MessageBuilder<'a, C, M>
impl<'a, C, M> IntoFuture for MessageBuilder<'a, C, M>
Source§type Output = Result<Arc<NewChatItemsResponse>, <C as ClientApi>::Error>
type Output = Result<Arc<NewChatItemsResponse>, <C as ClientApi>::Error>
The output that the future will produce on completion.
Source§type IntoFuture = Pin<Box<dyn Future<Output = <MessageBuilder<'a, C, M> as IntoFuture>::Output> + Send + 'a>>
type IntoFuture = Pin<Box<dyn Future<Output = <MessageBuilder<'a, C, M> as IntoFuture>::Output> + Send + 'a>>
Which kind of future are we turning this into?
Source§fn into_future(self) -> Self::IntoFuture
fn into_future(self) -> Self::IntoFuture
Creates a future from a value. Read more
Source§impl<'a, C> IntoFuture for MessageBuilder<'a, C, PreviewableKind>
impl<'a, C> IntoFuture for MessageBuilder<'a, C, PreviewableKind>
Source§type Output = Result<Arc<NewChatItemsResponse>, <C as ClientApi>::Error>
type Output = Result<Arc<NewChatItemsResponse>, <C as ClientApi>::Error>
The output that the future will produce on completion.
Source§type IntoFuture = Pin<Box<dyn Future<Output = <MessageBuilder<'a, C, PreviewableKind> as IntoFuture>::Output> + Send + 'a>>
type IntoFuture = Pin<Box<dyn Future<Output = <MessageBuilder<'a, C, PreviewableKind> as IntoFuture>::Output> + Send + 'a>>
Which kind of future are we turning this into?
Source§fn into_future(self) -> Self::IntoFuture
fn into_future(self) -> Self::IntoFuture
Creates a future from a value. Read more
Auto Trait Implementations§
impl<'a, C, M> Freeze for MessageBuilder<'a, C, M>
impl<'a, C, M> RefUnwindSafe for MessageBuilder<'a, C, M>
impl<'a, C, M> Send for MessageBuilder<'a, C, M>
impl<'a, C, M> Sync for MessageBuilder<'a, C, M>
impl<'a, C, M> Unpin for MessageBuilder<'a, C, M>
impl<'a, C, M> UnsafeUnpin for MessageBuilder<'a, C, M>where
M: UnsafeUnpin,
C: ?Sized,
impl<'a, C, M> UnwindSafe for MessageBuilder<'a, C, M>
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