pub fn run<F: Future<Output = ()> + Send>(future: F)๐Deprecated since 1.0.0-beta.2:
Use #tokio::main directly instead
Expand description
Run an async entry point with a tokio runtime configured for Telegram bot workloads.
Uses sensible defaults: all CPU cores as worker threads, 8 MB stack per thread (needed for the deeply nested async state machines in Bot API calls).
ยงBasic usage
โ
fn main() {
rust_tg_bot::run(async {
let app = ApplicationBuilder::new().token(token).build();
app.run_polling().await.unwrap();
});
}ยงCustom configuration
โ
fn main() {
rust_tg_bot::run_configured(
RuntimeConfig::default().workers(4),
async { /* ... */ },
);
}