telegram-bot
telegram-bot copied to clipboard
Make hyper and tokio optional dependencies
This pull request adds two default features runtime-tokio and connector-hyper, which control if the default runtime / connector implementation is present.
This change makes it possible to use this crate in environments where Tokio and/or hyper cannot be used, and the end user wants to provide their own Connector implementation (e.g. Cloudflare Worker (worker-rs, Fetch), Phala Network (sidevm, see #266)).
Notably, Api::send_timeout currently depends on Tokio, so we have to disable that if runtime-tokio is not selected. In those cases, we are forced to use Api::send without timeouts in UpdatesStream. This may be suboptimal, but should yield correct behavior nevertheless.