mirror of
https://github.com/teloxide/teloxide.git
synced 2025-01-03 09:49:07 +01:00
Deprecate HandlerFactory
and HandlerExt::dispatch_by
This commit is contained in:
parent
4530f935cb
commit
ffcdba0e1d
4 changed files with 13 additions and 4 deletions
|
@ -26,6 +26,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Rename `BotCommand` trait to `BotCommands` [**BC**].
|
||||
- `BotCommands::descriptions` now returns `CommandDescriptions` instead of `String` [**BC**].
|
||||
|
||||
### Deprecated
|
||||
|
||||
- `HandlerFactory` and `HandlerExt::dispatch_by` in favour of `teloxide::handler!`.
|
||||
|
||||
## 0.7.2 - 2022-03-23
|
||||
|
||||
### Added
|
||||
|
|
|
@ -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>,
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue