From 47a70b8587227c6652871e7d11f326a50288181e Mon Sep 17 00:00:00 2001 From: Temirkhan Myrzamadi Date: Tue, 11 Feb 2020 19:55:24 +0600 Subject: [PATCH] Fix the documentation --- src/dispatching/dialogue/mod.rs | 36 +++++++++++++++++---------------- 1 file changed, 19 insertions(+), 17 deletions(-) diff --git a/src/dispatching/dialogue/mod.rs b/src/dispatching/dialogue/mod.rs index 4294eb5e..3602a669 100644 --- a/src/dispatching/dialogue/mod.rs +++ b/src/dispatching/dialogue/mod.rs @@ -2,35 +2,37 @@ //! //! There are four main components: //! -//! 1. Your session type `Session`, which designates a dialogue state at the -//! current moment. -//! 2. [`Storage`], which encapsulates all the sessions. -//! 3. Your handler, which receives an update and turns your session into the +//! 1. Your type `State`, which designates a dialogue state at the current +//! moment. +//! 2. Your type `T`, which represents dialogue data. +//! 3. [`Dialogue`], which encapsulates the two types, described above. +//! 4. [`Storage`], which encapsulates all the sessions. +//! 5. Your handler, which receives an update and turns your session into the //! next state. -//! 4. [`SessionDispatcher`], which encapsulates your handler, [`Storage`], and +//! 6. [`DialogueDispatcher`], which encapsulates your handler, [`Storage`], and //! implements [`CtxHandler`]. //! -//! You supply [`SessionDispatcher`] into [`Dispatcher`]. Every time -//! [`Dispatcher`] calls `SessionDispatcher::handle_ctx(...)`, the following +//! You supply [`DialogueDispatcher`] into [`Dispatcher`]. Every time +//! [`Dispatcher`] calls `DialogueDispatcher::handle_ctx(...)`, the following //! steps are executed: //! -//! 1. If a storage doesn't contain a session from this chat, supply -//! `Session::default()` into you handler, otherwise, supply the saved session +//! 1. If a storage doesn't contain a dialogue from this chat, supply +//! `Dialogue::default()` into you handler, otherwise, supply the saved session //! from this chat. -//! 3. If a handler has returned [`SessionState::Exit`], remove the session -//! from the storage, otherwise ([`SessionState::Next`]) force the storage to +//! 3. If a handler has returned [`DialogueStage::Exit`], remove the session +//! from the storage, otherwise ([`DialogueStage::Next`]) force the storage to //! update the session. //! +//! Please, see https://github.com/teloxide/teloxide/tree/dev/examples/simple_dialogue. +//! //! [`Storage`]: crate::dispatching::session::Storage -//! [`SessionDispatcher`]: crate::dispatching::session::SessionDispatcher -//! [`SessionState::Exit`]: -//! crate::dispatching::session::SessionState::Exit -//! [`SessionState::Next`]: crate::dispatching::session::SessionState::Next +//! [`DialogueDispatcher`]: crate::dispatching::session::SessionDispatcher +//! [`DialogueStage::Exit`]: +//! crate::dispatching::dialogue::DialogueStage::Exit +//! [`DialogueStage::Next`]: crate::dispatching::dialogue::DialogueStage::Next //! [`CtxHandler`]: crate::dispatching::CtxHandler //! [`Dispatcher`]: crate::dispatching::Dispatcher -// TODO: examples - #![allow(clippy::module_inception)] #![allow(clippy::type_complexity)]