pub struct ApplicationBuilder<State = NoToken> { /* private fields */ }Expand description
Typestate builder for constructing an Application.
The builder enforces at compile time that a bot token is set before
build can be called, using the
NoToken / HasToken marker types.
Implementations§
Source§impl<S> ApplicationBuilder<S>
impl<S> ApplicationBuilder<S>
Sourcepub fn request(self, request: Arc<dyn BaseRequest>) -> Self
pub fn request(self, request: Arc<dyn BaseRequest>) -> Self
Set a custom HTTP request backend for the bot.
Sourcepub fn base_url(self, url: impl Into<String>) -> Self
pub fn base_url(self, url: impl Into<String>) -> Self
Override the base URL for Telegram Bot API requests.
Sourcepub fn base_file_url(self, url: impl Into<String>) -> Self
pub fn base_file_url(self, url: impl Into<String>) -> Self
Override the base URL for downloading files from Telegram.
Sourcepub fn defaults(self, defaults: Defaults) -> Self
pub fn defaults(self, defaults: Defaults) -> Self
Set default values (e.g. parse_mode) applied to every API call.
Sourcepub fn arbitrary_callback_data(self, maxsize: usize) -> Self
pub fn arbitrary_callback_data(self, maxsize: usize) -> Self
Enable the arbitrary callback data cache with the given maximum size.
Sourcepub fn rate_limiter(self, _rl: ()) -> Self
pub fn rate_limiter(self, _rl: ()) -> Self
Sets the rate-limiter placeholder (feature disabled).
Sourcepub fn context_types(self, ct: ContextTypes) -> Self
pub fn context_types(self, ct: ContextTypes) -> Self
Set custom context types for the application.
Sourcepub fn concurrent_updates(self, n: usize) -> Self
pub fn concurrent_updates(self, n: usize) -> Self
Set the maximum number of concurrent update processing tasks. Minimum is 1.
Sourcepub fn post_init(self, hook: LifecycleHook) -> Self
pub fn post_init(self, hook: LifecycleHook) -> Self
Register a hook to run after the application has been initialized.
Sourcepub fn post_stop(self, hook: LifecycleHook) -> Self
pub fn post_stop(self, hook: LifecycleHook) -> Self
Register a hook to run after the application has stopped.
Sourcepub fn post_shutdown(self, hook: LifecycleHook) -> Self
pub fn post_shutdown(self, hook: LifecycleHook) -> Self
Register a hook to run after the application has been fully shut down.
Source§impl ApplicationBuilder<HasToken>
impl ApplicationBuilder<HasToken>
Sourcepub fn build(self) -> Arc<Application>
pub fn build(self) -> Arc<Application>
Consume the builder and construct the Application.