Merge pull request #582 from teloxide/deprecate-dispatch-by

Deprecate `HandlerFactory` and `HandlerExt::dispatch_by`
This commit is contained in:
Hirrolot 2022-04-10 22:53:37 +06:00 committed by GitHub
commit 5e21c4d881
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 13 additions and 4 deletions

View file

@ -27,6 +27,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- `BotCommands::descriptions` now returns `CommandDescriptions` instead of `String` [**BC**].
- Mark `Dialogue::new` as `#[must_use]`.
### Deprecated
- `HandlerFactory` and `HandlerExt::dispatch_by` in favour of `teloxide::handler!`.
## 0.7.2 - 2022-03-23
### Added

View file

@ -1,15 +1,15 @@
use std::sync::Arc;
use crate::{
dispatching::{
dialogue::{Dialogue, GetChatId, Storage},
HandlerFactory,
},
dispatching::dialogue::{Dialogue, GetChatId, Storage},
types::{Me, Message},
utils::command::BotCommands,
};
use dptree::{di::DependencyMap, Handler};
#[allow(deprecated)]
use crate::dispatching::HandlerFactory;
use std::fmt::Debug;
/// Extension methods for working with `dptree` handlers.
@ -51,6 +51,8 @@ pub trait HandlerExt<Output> {
Upd: GetChatId + Clone + Send + Sync + 'static;
#[must_use]
#[deprecated(note = "Use the teloxide::handler! API")]
#[allow(deprecated)]
fn dispatch_by<F>(self) -> Self
where
F: HandlerFactory<Out = Output>;
@ -92,6 +94,7 @@ where
}))
}
#[allow(deprecated)]
fn dispatch_by<F>(self) -> Self
where
F: HandlerFactory<Out = Output>,

View file

@ -1,6 +1,7 @@
use dptree::{di::DependencyMap, Handler};
/// Something that can construct a handler.
#[deprecated(note = "Use the teloxide::handler! API")]
pub trait HandlerFactory {
type Out;

View file

@ -110,4 +110,5 @@ pub use crate::utils::shutdown_token::{IdleShutdownError, ShutdownToken};
pub use dispatcher::{Dispatcher, DispatcherBuilder, UpdateHandler};
pub use filter_ext::{MessageFilterExt, UpdateFilterExt};
pub use handler_ext::HandlerExt;
#[allow(deprecated)]
pub use handler_factory::HandlerFactory;