pub struct MessageBuilder { /* private fields */ }Expand description
Builds a Message from styled spans.
Formatting is expressed as Telegram entities rather than as parse_mode
markup, which means interpolated text is never parsed and therefore never
needs escaping. A filename, a username, or an arbitrary error string can be
passed straight through with no sanitizing step.
Implementations§
Source§impl MessageBuilder
impl MessageBuilder
Sourcepub fn styled(self, text: impl AsRef<str>, style: Style) -> Self
pub fn styled(self, text: impl AsRef<str>, style: Style) -> Self
Appends text carrying an arbitrary combination of inline styles.
Sourcepub fn strikethrough(self, text: impl AsRef<str>) -> Self
pub fn strikethrough(self, text: impl AsRef<str>) -> Self
Appends struck-through text.
Sourcepub fn link(self, text: impl AsRef<str>, url: impl Into<String>) -> Self
pub fn link(self, text: impl AsRef<str>, url: impl Into<String>) -> Self
Appends text which links to a URL.
Sourcepub fn mention(self, text: impl AsRef<str>, user_id: i64) -> Self
pub fn mention(self, text: impl AsRef<str>, user_id: i64) -> Self
Appends a mention of a user who has no username.
Sourcepub fn custom_emoji(
self,
text: impl AsRef<str>,
custom_emoji_id: impl Into<String>,
) -> Self
pub fn custom_emoji( self, text: impl AsRef<str>, custom_emoji_id: impl Into<String>, ) -> Self
Appends an inline custom emoji sticker.
Sourcepub fn pre(self, text: impl AsRef<str>, language: Option<&str>) -> Self
pub fn pre(self, text: impl AsRef<str>, language: Option<&str>) -> Self
Appends a preformatted block, optionally tagged with a language.
Only available at the top level: Telegram does not permit pre to be
nested inside other entities.
Sourcepub fn blockquote(
self,
build: impl FnOnce(InlineBuilder) -> InlineBuilder,
) -> Self
pub fn blockquote( self, build: impl FnOnce(InlineBuilder) -> InlineBuilder, ) -> Self
Appends a block quotation containing inline-formatted content.
Sourcepub fn expandable_blockquote(
self,
build: impl FnOnce(InlineBuilder) -> InlineBuilder,
) -> Self
pub fn expandable_blockquote( self, build: impl FnOnce(InlineBuilder) -> InlineBuilder, ) -> Self
Appends a block quotation which is collapsed by default.
Sourcepub fn photo(self, source: FileSource) -> Self
pub fn photo(self, source: FileSource) -> Self
Attaches a photo, making the accumulated text its caption.
Sourcepub fn document(self, source: FileSource) -> Self
pub fn document(self, source: FileSource) -> Self
Attaches a document, making the accumulated text its caption.
Sourcepub const fn disable_notification(self, disable: bool) -> Self
pub const fn disable_notification(self, disable: bool) -> Self
Delivers the message silently, without a notification sound.
Sourcepub const fn protect_content(self, protect: bool) -> Self
pub const fn protect_content(self, protect: bool) -> Self
Prevents the message from being forwarded or saved.
Sourcepub const fn disable_link_preview(self, disable: bool) -> Self
pub const fn disable_link_preview(self, disable: bool) -> Self
Controls whether a link in the message generates a preview card.
Sourcepub const fn message_thread_id(self, thread_id: i64) -> Self
pub const fn message_thread_id(self, thread_id: i64) -> Self
Targets a specific topic within a forum chat.
Sourcepub const fn reply_to_message_id(self, message_id: i64) -> Self
pub const fn reply_to_message_id(self, message_id: i64) -> Self
Sends the message as a reply to an existing one.
Trait Implementations§
Source§impl Clone for MessageBuilder
impl Clone for MessageBuilder
Source§impl Debug for MessageBuilder
impl Debug for MessageBuilder
Auto Trait Implementations§
impl Freeze for MessageBuilder
impl RefUnwindSafe for MessageBuilder
impl Send for MessageBuilder
impl Sync for MessageBuilder
impl Unpin for MessageBuilder
impl UnsafeUnpin for MessageBuilder
impl UnwindSafe for MessageBuilder
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<T> ServiceExt for T
impl<T> ServiceExt for T
Source§fn propagate_header(self, header: HeaderName) -> PropagateHeader<Self>where
Self: Sized,
fn propagate_header(self, header: HeaderName) -> PropagateHeader<Self>where
Self: Sized,
Source§fn add_extension<T>(self, value: T) -> AddExtension<Self, T>where
Self: Sized,
fn add_extension<T>(self, value: T) -> AddExtension<Self, T>where
Self: Sized,
Source§fn map_request_body<F>(self, f: F) -> MapRequestBody<Self, F>where
Self: Sized,
fn map_request_body<F>(self, f: F) -> MapRequestBody<Self, F>where
Self: Sized,
Source§fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
fn map_response_body<F>(self, f: F) -> MapResponseBody<Self, F>where
Self: Sized,
Source§fn compression(self) -> Compression<Self>where
Self: Sized,
fn compression(self) -> Compression<Self>where
Self: Sized,
Source§fn decompression(self) -> Decompression<Self>where
Self: Sized,
fn decompression(self) -> Decompression<Self>where
Self: Sized,
Source§fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
fn trace_for_http(self) -> Trace<Self, SharedClassifier<ServerErrorsAsFailures>>where
Self: Sized,
Source§fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
fn trace_for_grpc(self) -> Trace<Self, SharedClassifier<GrpcErrorsAsFailures>>where
Self: Sized,
Source§fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
fn follow_redirects(self) -> FollowRedirect<Self>where
Self: Sized,
Source§fn sensitive_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>where
Self: Sized,
fn sensitive_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<SetSensitiveResponseHeaders<Self>>where
Self: Sized,
Source§fn sensitive_request_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<Self>where
Self: Sized,
fn sensitive_request_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveRequestHeaders<Self>where
Self: Sized,
Source§fn sensitive_response_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveResponseHeaders<Self>where
Self: Sized,
fn sensitive_response_headers(
self,
headers: impl IntoIterator<Item = HeaderName>,
) -> SetSensitiveResponseHeaders<Self>where
Self: Sized,
Source§fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn override_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
Source§fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn append_request_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
Source§fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
fn insert_request_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetRequestHeader<Self, M>where
Self: Sized,
Source§fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn override_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
Source§fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn append_response_header<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
Source§fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
fn insert_response_header_if_not_present<M>(
self,
header_name: HeaderName,
make: M,
) -> SetResponseHeader<Self, M>where
Self: Sized,
Source§fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_request_id<M>(
self,
header_name: HeaderName,
make_request_id: M,
) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
Source§fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
fn set_x_request_id<M>(self, make_request_id: M) -> SetRequestId<Self, M>where
Self: Sized,
M: MakeRequestId,
x-request-id as the header name. Read moreSource§fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_request_id(
self,
header_name: HeaderName,
) -> PropagateRequestId<Self>where
Self: Sized,
Source§fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
fn propagate_x_request_id(self) -> PropagateRequestId<Self>where
Self: Sized,
x-request-id as the header name. Read moreSource§fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
fn catch_panic(self) -> CatchPanic<Self, DefaultResponseForPanic>where
Self: Sized,
500 Internal Server responses. Read moreSource§fn request_body_limit(self, limit: usize) -> RequestBodyLimit<Self>where
Self: Sized,
fn request_body_limit(self, limit: usize) -> RequestBodyLimit<Self>where
Self: Sized,
413 Payload Too Large responses. Read more