mirror of
https://github.com/teloxide/teloxide.git
synced 2025-03-14 11:44:04 +01:00
SubTransition -> Subtransition, SubTransitionOutputType -> SubtransitionOutputType
This commit is contained in:
parent
54135aae3c
commit
d43d74d80c
3 changed files with 11 additions and 11 deletions
|
@ -7,7 +7,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
## [0.3.0] - ???
|
||||
### Added
|
||||
- `BotBuilder`, which allows setting a default `ParseMode`.
|
||||
- The `Transition`, `SubTransition`, `SubTransitionOutputType` traits.
|
||||
- The `Transition`, `Subtransition`, `SubtransitionOutputType` traits.
|
||||
- A nicer approach to manage dialogues via `#[derive(Transition)]` + `#[teloxide(transition)]` (see `examples/dialogue_bot`).
|
||||
|
||||
### Deprecated
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
//! It is essentially a [FSM]: its variants are possible dialogue states and
|
||||
//! [`Transition::react`] is a transition function.
|
||||
//!
|
||||
//! 2. State types, forming `D`. They implement [`SubTransition`].
|
||||
//! 2. State types, forming `D`. They implement [`Subtransition`].
|
||||
//!
|
||||
//! 2. [`Storage<D>`], which encapsulates all the dialogues.
|
||||
//!
|
||||
|
@ -99,19 +99,19 @@
|
|||
//! }
|
||||
//! ```
|
||||
//!
|
||||
//! - `#[teloxide(transition)]` implements [`SubTransition`] for the first
|
||||
//! - `#[teloxide(transition)]` implements [`Subtransition`] for the first
|
||||
//! argument of a function.
|
||||
//! - `#[derive(Transition)]` implements [`Transition`] for `D`, if all the
|
||||
//! variants implement [`SubTransition`].
|
||||
//! variants implement [`Subtransition`].
|
||||
//!
|
||||
//! `()` in `.react(cx, ())` is an arbitrary value, which you can pass into
|
||||
//! subtransitions. Just append `ans: T` to the parameters of the
|
||||
//! subtransitions to pass a differen type.
|
||||
//! Subtransitions. Just append `ans: T` to the parameters of the
|
||||
//! Subtransitions to pass a differen type.
|
||||
//!
|
||||
//! See [examples/dialogue_bot] as a real example.
|
||||
//!
|
||||
//! [`Transition`]: crate::dispatching::dialogue::Transition
|
||||
//! [`SubTransition`]: crate::dispatching::dialogue::SubTransition
|
||||
//! [`Subtransition`]: crate::dispatching::dialogue::Subtransition
|
||||
//! [`Transition::react`]:
|
||||
//! crate::dispatching::dialogue::Transition::react
|
||||
//! [FSM]: https://en.wikipedia.org/wiki/Finite-state_machine
|
||||
|
@ -153,7 +153,7 @@ pub use dialogue_stage::{exit, next, DialogueStage};
|
|||
pub use dialogue_with_cx::DialogueWithCx;
|
||||
pub use get_chat_id::GetChatId;
|
||||
pub use transition::{
|
||||
SubTransition, SubTransitionOutputType, Transition, TransitionIn, TransitionOut,
|
||||
Subtransition, SubtransitionOutputType, Transition, TransitionIn, TransitionOut,
|
||||
};
|
||||
|
||||
#[cfg(feature = "redis-storage")]
|
||||
|
|
|
@ -18,7 +18,7 @@ pub trait Transition: Sized {
|
|||
/// Like [`Transition`], but from `StateN` -> `Dialogue`.
|
||||
///
|
||||
/// [`Transition`]: crate::dispatching::dialogue::Transition
|
||||
pub trait SubTransition
|
||||
pub trait Subtransition
|
||||
where
|
||||
Self::Dialogue: Transition<Aux = Self::Aux>,
|
||||
{
|
||||
|
@ -39,11 +39,11 @@ where
|
|||
/// A type returned from a FSM subtransition function.
|
||||
///
|
||||
/// Now it is used only inside `#[teloxide(transition)]` for type inference.
|
||||
pub trait SubTransitionOutputType {
|
||||
pub trait SubtransitionOutputType {
|
||||
type Output;
|
||||
}
|
||||
|
||||
impl<D> SubTransitionOutputType for TransitionOut<D> {
|
||||
impl<D> SubtransitionOutputType for TransitionOut<D> {
|
||||
type Output = D;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue