Fix the documentation

This commit is contained in:
Temirkhan Myrzamadi 2020-02-11 19:55:24 +06:00
parent 14561e437f
commit 47a70b8587

View file

@ -2,35 +2,37 @@
//! //!
//! There are four main components: //! There are four main components:
//! //!
//! 1. Your session type `Session`, which designates a dialogue state at the //! 1. Your type `State`, which designates a dialogue state at the current
//! current moment. //! moment.
//! 2. [`Storage`], which encapsulates all the sessions. //! 2. Your type `T`, which represents dialogue data.
//! 3. Your handler, which receives an update and turns your session into the //! 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. //! next state.
//! 4. [`SessionDispatcher`], which encapsulates your handler, [`Storage`], and //! 6. [`DialogueDispatcher`], which encapsulates your handler, [`Storage`], and
//! implements [`CtxHandler`]. //! implements [`CtxHandler`].
//! //!
//! You supply [`SessionDispatcher`] into [`Dispatcher`]. Every time //! You supply [`DialogueDispatcher`] into [`Dispatcher`]. Every time
//! [`Dispatcher`] calls `SessionDispatcher::handle_ctx(...)`, the following //! [`Dispatcher`] calls `DialogueDispatcher::handle_ctx(...)`, the following
//! steps are executed: //! steps are executed:
//! //!
//! 1. If a storage doesn't contain a session from this chat, supply //! 1. If a storage doesn't contain a dialogue from this chat, supply
//! `Session::default()` into you handler, otherwise, supply the saved session //! `Dialogue::default()` into you handler, otherwise, supply the saved session
//! from this chat. //! from this chat.
//! 3. If a handler has returned [`SessionState::Exit`], remove the session //! 3. If a handler has returned [`DialogueStage::Exit`], remove the session
//! from the storage, otherwise ([`SessionState::Next`]) force the storage to //! from the storage, otherwise ([`DialogueStage::Next`]) force the storage to
//! update the session. //! update the session.
//! //!
//! Please, see https://github.com/teloxide/teloxide/tree/dev/examples/simple_dialogue.
//!
//! [`Storage`]: crate::dispatching::session::Storage //! [`Storage`]: crate::dispatching::session::Storage
//! [`SessionDispatcher`]: crate::dispatching::session::SessionDispatcher //! [`DialogueDispatcher`]: crate::dispatching::session::SessionDispatcher
//! [`SessionState::Exit`]: //! [`DialogueStage::Exit`]:
//! crate::dispatching::session::SessionState::Exit //! crate::dispatching::dialogue::DialogueStage::Exit
//! [`SessionState::Next`]: crate::dispatching::session::SessionState::Next //! [`DialogueStage::Next`]: crate::dispatching::dialogue::DialogueStage::Next
//! [`CtxHandler`]: crate::dispatching::CtxHandler //! [`CtxHandler`]: crate::dispatching::CtxHandler
//! [`Dispatcher`]: crate::dispatching::Dispatcher //! [`Dispatcher`]: crate::dispatching::Dispatcher
// TODO: examples
#![allow(clippy::module_inception)] #![allow(clippy::module_inception)]
#![allow(clippy::type_complexity)] #![allow(clippy::type_complexity)]