Merge pull request #611 from teloxide/master-copy

Bring changes from master to dev try 2
This commit is contained in:
Waffle Maybe 2022-04-26 18:09:44 +04:00 committed by GitHub
commit 056b6df3eb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 62 additions and 54 deletions

View file

@ -16,6 +16,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
[Bot API 6.0]: https://core.telegram.org/bots/api#april-16-2022 [Bot API 6.0]: https://core.telegram.org/bots/api#april-16-2022
## 0.8.2 - 2022-04-26
### Fixed
- Fix the broken `#[derive(DialogueState)]` (function return type `dptree::Handler`).
## 0.8.1 - 2022-04-24 ## 0.8.1 - 2022-04-24
### Added ### Added

View file

@ -1,6 +1,6 @@
[package] [package]
name = "teloxide" name = "teloxide"
version = "0.8.1" version = "0.8.2"
edition = "2021" edition = "2021"
description = "An elegant Telegram bots framework for Rust" description = "An elegant Telegram bots framework for Rust"
repository = "https://github.com/teloxide/teloxide" repository = "https://github.com/teloxide/teloxide"
@ -57,7 +57,7 @@ full = [
[dependencies] [dependencies]
teloxide-core = { version = "0.6.0", default-features = false } teloxide-core = { version = "0.6.0", default-features = false }
teloxide-macros = { version = "0.6.0", optional = true } teloxide-macros = { version = "0.6.1", optional = true }
serde_json = "1.0" serde_json = "1.0"
serde = { version = "1.0", features = ["derive"] } serde = { version = "1.0", features = ["derive"] }

View file

@ -1,62 +1,64 @@
// #[cfg(feature = "macros")] #![allow(deprecated)]
// use teloxide::macros::DialogueState;
// // We put tests here because macro expand in unit tests in the crate was a
// // failure
// #[test] #[cfg(feature = "macros")]
// #[cfg(feature = "macros")] use teloxide::macros::DialogueState;
// fn compile_test() { // We put tests here because macro expand in unit tests in the crate was a
// #[allow(dead_code)] // failure
// #[derive(DialogueState, Clone)]
// #[handler_out(Result<(), teloxide::RequestError>)]
// enum State {
// #[handler(handle_start)]
// Start,
// #[handler(handle_have_data)] #[test]
// HaveData(String), #[cfg(feature = "macros")]
// } fn compile_test() {
#[allow(dead_code)]
#[derive(DialogueState, Clone)]
#[handler_out(Result<(), teloxide::RequestError>)]
enum State {
#[handler(handle_start)]
Start,
// impl Default for State { #[handler(handle_have_data)]
// fn default() -> Self { HaveData(String),
// Self::Start }
// }
// }
// async fn handle_start() -> Result<(), teloxide::RequestError> { impl Default for State {
// Ok(()) fn default() -> Self {
// } Self::Start
}
}
// async fn handle_have_data() -> Result<(), teloxide::RequestError> { async fn handle_start() -> Result<(), teloxide::RequestError> {
// Ok(()) Ok(())
// } }
// }
// #[test] async fn handle_have_data() -> Result<(), teloxide::RequestError> {
// #[cfg(feature = "macros")] Ok(())
// fn compile_test_generics() { }
// #[allow(dead_code)] }
// #[derive(DialogueState, Clone)]
// #[handler_out(Result<(), teloxide::RequestError>)]
// enum State<X: Clone + Send + Sync + 'static> {
// #[handler(handle_start)]
// Start,
// #[handler(handle_have_data)] #[test]
// HaveData(X), #[cfg(feature = "macros")]
// } fn compile_test_generics() {
#[allow(dead_code)]
#[derive(DialogueState, Clone)]
#[handler_out(Result<(), teloxide::RequestError>)]
enum State<X: Clone + Send + Sync + 'static> {
#[handler(handle_start)]
Start,
// impl<X: Clone + Send + Sync + 'static> Default for State<X> { #[handler(handle_have_data)]
// fn default() -> Self { HaveData(X),
// Self::Start }
// }
// }
// async fn handle_start() -> Result<(), teloxide::RequestError> { impl<X: Clone + Send + Sync + 'static> Default for State<X> {
// Ok(()) fn default() -> Self {
// } Self::Start
}
}
// async fn handle_have_data() -> Result<(), teloxide::RequestError> { async fn handle_start() -> Result<(), teloxide::RequestError> {
// Ok(()) Ok(())
// } }
// }
async fn handle_have_data() -> Result<(), teloxide::RequestError> {
Ok(())
}
}