From 3ecb3fb06a51578617d55a0983ab90ca84af384b Mon Sep 17 00:00:00 2001 From: Maybe Waffle Date: Mon, 31 Oct 2022 13:44:32 +0400 Subject: [PATCH] Add stop token changes to the migration guide Former-commit-id: 7287ffe2f0e212a20843c709cdfbdb31fb462544 --- MIGRATION_GUIDE.md | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/MIGRATION_GUIDE.md b/MIGRATION_GUIDE.md index de6665c4..0c8a33bf 100644 --- a/MIGRATION_GUIDE.md +++ b/MIGRATION_GUIDE.md @@ -91,6 +91,16 @@ teloxide::repl(bot, |bot: Bot, msg: Message| async move { This is because REPLs now require the closure to return `RequestError` instead of a generic error type, so type inference works perfectly for a return value. If you use something other than `RequestError`, you can transfer your code to `teloxide::dispatching`, which still permits a generic error type. +"Stop tokens" were refactored, the trait is now removed and the types were renamed: + +```diff +-use teloxide::dispatching::stop_token::{AsyncStopToken, AsyncStopFlag}; ++use teloxide::stop::{StopToken, StopFlag, mk_stop_token}; + +-let (token, flag): (AsyncStopToken, AsyncStopFlag) = AsyncStopToken::new_pair(); ++let (token, flag): (StopToken, StopFlag) = mk_stop_token(); +``` + ### macros `parse_with` now accepts a Rust _path_ to a custom parser function instead of a string: