pub struct TelegramSettingsBuilder { /* private fields */ }Expand description
Builds a TelegramSettings.
Implementations§
Source§impl TelegramSettingsBuilder
impl TelegramSettingsBuilder
Sourcepub fn base_url(self, base_url: impl Into<String>) -> Self
pub fn base_url(self, base_url: impl Into<String>) -> Self
Overrides the API base URL.
Intended for pointing tests at a local mock server, or for a self-hosted Bot API server. Production should leave this at its default.
Sourcepub const fn connect_timeout(self, timeout: Duration) -> Self
pub const fn connect_timeout(self, timeout: Duration) -> Self
Overrides the connection timeout.
Sourcepub const fn request_timeout(self, timeout: Duration) -> Self
pub const fn request_timeout(self, timeout: Duration) -> Self
Overrides the total request timeout.
Sourcepub const fn queue_capacity(self, capacity: usize) -> Self
pub const fn queue_capacity(self, capacity: usize) -> Self
Overrides how many messages are held per chat before sends are dropped.
Sourcepub const fn max_chunks(self, max_chunks: usize) -> Self
pub const fn max_chunks(self, max_chunks: usize) -> Self
Overrides how many messages one oversized message may become.
Sourcepub const fn max_input_bytes(self, max_bytes: usize) -> Self
pub const fn max_input_bytes(self, max_bytes: usize) -> Self
Overrides the largest message accepted, in bytes.
Sourcepub const fn max_retries(self, retries: u32) -> Self
pub const fn max_retries(self, retries: u32) -> Self
Overrides how many times a transient failure is retried.
Sourcepub const fn max_retry_after(self, max_retry_after: Duration) -> Self
pub const fn max_retry_after(self, max_retry_after: Duration) -> Self
Overrides the longest retry_after which will be honored.
Sourcepub const fn per_chat_interval(self, interval: Duration) -> Self
pub const fn per_chat_interval(self, interval: Duration) -> Self
Overrides the minimum spacing between messages to the same chat.
Sourcepub const fn global_per_second(self, per_second: u32) -> Self
pub const fn global_per_second(self, per_second: u32) -> Self
Overrides the ceiling on messages per second across all chats.
Sourcepub fn build(self) -> Result<TelegramSettings, TelegramError>
pub fn build(self) -> Result<TelegramSettings, TelegramError>
Validates and finalizes the settings.
§Errors
Returns TelegramError::InvalidToken if the token is blank or
malformed. A blank-but-present token is treated as missing, because a
server which boots with one looks healthy while notifying nobody.
Trait Implementations§
Source§impl Clone for TelegramSettingsBuilder
impl Clone for TelegramSettingsBuilder
Source§fn clone(&self) -> TelegramSettingsBuilder
fn clone(&self) -> TelegramSettingsBuilder
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more