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:
//!
//! 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)]