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
## 0.8.2 - 2022-04-26
### Fixed
- Fix the broken `#[derive(DialogueState)]` (function return type `dptree::Handler`).
## 0.8.1 - 2022-04-24
### Added

View file

@ -1,6 +1,6 @@
[package]
name = "teloxide"
version = "0.8.1"
version = "0.8.2"
edition = "2021"
description = "An elegant Telegram bots framework for Rust"
repository = "https://github.com/teloxide/teloxide"
@ -57,7 +57,7 @@ full = [
[dependencies]
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 = { version = "1.0", features = ["derive"] }

View file

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