mirror of
https://github.com/teloxide/teloxide.git
synced 2024-12-23 06:51:01 +01:00
Add stop token changes to the migration guide
Former-commit-id: 7287ffe2f0
This commit is contained in:
parent
e094d6a20a
commit
3ecb3fb06a
1 changed files with 10 additions and 0 deletions
|
@ -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.
|
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
|
### macros
|
||||||
|
|
||||||
`parse_with` now accepts a Rust _path_ to a custom parser function instead of a string:
|
`parse_with` now accepts a Rust _path_ to a custom parser function instead of a string:
|
||||||
|
|
Loading…
Reference in a new issue