Skip to main content

MessageBuilder

Struct MessageBuilder 

Source
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>

Source

pub fn live_message(self) -> Self

Source

pub fn with_ttl(self, ttl: Duration) -> Self

Source

pub fn reply_to(self, msg_id: impl Into<MessageId>) -> Self

Source

pub fn set_text(self, text: impl Into<String>) -> Self

Source

pub fn send(self) -> <Self as IntoFuture>::IntoFuture
where 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>

Source

pub fn with_image(self, img: Image) -> MessageBuilder<'a, C, PreviewableKind>

Source

pub fn with_video(self, vid: Video) -> MessageBuilder<'a, C, PreviewableKind>

Source

pub fn attach(self, img: CryptoFile) -> MessageBuilder<'a, C, RichKind>

Source

pub fn report(self, reason: ReportReason) -> MessageBuilder<'a, C, RichKind>

Source§

impl<'a, C> MessageBuilder<'a, C, RichKind>

Source

pub fn set_file_source(self, source: CryptoFile) -> Self

Source§

impl<'a, C> MessageBuilder<'a, C, PreviewableKind>

Source

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>
where C: 'static + ClientApi, C::Error: 'static + Send, M: SimplySendable,

Source§

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>>

Which kind of future are we turning this into?
Source§

fn into_future(self) -> Self::IntoFuture

Creates a future from a value. Read more
Source§

impl<'a, C> IntoFuture for MessageBuilder<'a, C, PreviewableKind>
where C: 'static + ClientApi, C::Error: 'static + Send,

Source§

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>>

Which kind of future are we turning this into?
Source§

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>
where M: Freeze, C: ?Sized,

§

impl<'a, C, M> RefUnwindSafe for MessageBuilder<'a, C, M>

§

impl<'a, C, M> Send for MessageBuilder<'a, C, M>
where M: Send, C: Sync + ?Sized,

§

impl<'a, C, M> Sync for MessageBuilder<'a, C, M>
where M: Sync, C: Sync + ?Sized,

§

impl<'a, C, M> Unpin for MessageBuilder<'a, C, M>
where M: Unpin, C: ?Sized,

§

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>
where M: UnwindSafe, C: RefUnwindSafe + ?Sized,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V