pub struct DefaultsBuilder { /* private fields */ }Expand description
Builder for Defaults.
Provides ergonomic construction without None, None, None argument lists.
§Example
let defaults = Defaults::builder()
.parse_mode("HTML")
.disable_notification(true)
.do_quote(true)
.build();
assert_eq!(defaults.parse_mode(), Some("HTML"));
assert_eq!(defaults.disable_notification(), Some(true));
assert!(defaults.block()); // defaults to trueImplementations§
Source§impl DefaultsBuilder
impl DefaultsBuilder
Sourcepub fn parse_mode(self, mode: impl Into<String>) -> Self
pub fn parse_mode(self, mode: impl Into<String>) -> Self
Sets the default parse mode (e.g. "HTML", "MarkdownV2").
Sourcepub fn disable_notification(self, value: bool) -> Self
pub fn disable_notification(self, value: bool) -> Self
Sets whether messages are sent silently by default.
Sourcepub fn allow_sending_without_reply(self, value: bool) -> Self
pub fn allow_sending_without_reply(self, value: bool) -> Self
Sets whether messages should be sent even if the replied-to message is not found.
Sourcepub fn protect_content(self, value: bool) -> Self
pub fn protect_content(self, value: bool) -> Self
Sets whether message contents are protected from forwarding and saving.
Sourcepub fn block(self, value: bool) -> Self
pub fn block(self, value: bool) -> Self
Sets the default block value for handlers. Defaults to true if not set.
Sourcepub fn link_preview_options(self, options: LinkPreviewOptions) -> Self
pub fn link_preview_options(self, options: LinkPreviewOptions) -> Self
Sets the default link preview options.
Trait Implementations§
Source§impl Debug for DefaultsBuilder
impl Debug for DefaultsBuilder
Auto Trait Implementations§
impl Freeze for DefaultsBuilder
impl RefUnwindSafe for DefaultsBuilder
impl Send for DefaultsBuilder
impl Sync for DefaultsBuilder
impl Unpin for DefaultsBuilder
impl UnsafeUnpin for DefaultsBuilder
impl UnwindSafe for DefaultsBuilder
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