make schema in docs nicer

This commit is contained in:
Maybe Waffle 2022-07-21 13:31:37 +04:00
parent 627b8624f3
commit 84beedfff4

View file

@ -58,25 +58,29 @@
//! # async fn receive_product_selection() -> HandlerResult { Ok(()) } //! # async fn receive_product_selection() -> HandlerResult { Ok(()) }
//! # //! #
//! fn schema() -> UpdateHandler<Box<dyn std::error::Error + Send + Sync + 'static>> { //! fn schema() -> UpdateHandler<Box<dyn std::error::Error + Send + Sync + 'static>> {
//! let command_handler = teloxide::filter_command::<Command, _>() //! use teloxide::dispatching::dialogue;
//! use teloxide::filter_command;
//! use dptree::case;
//!
//! let command_handler = filter_command::<Command, _>()
//! .branch( //! .branch(
//! dptree::case![State::Start] //! case![State::Start]
//! .branch(dptree::case![Command::Help].endpoint(help)) //! .branch(case![Command::Help].endpoint(help))
//! .branch(dptree::case![Command::Start].endpoint(start)), //! .branch(case![Command::Start].endpoint(start)),
//! ) //! )
//! .branch(dptree::case![Command::Cancel].endpoint(cancel)); //! .branch(case![Command::Cancel].endpoint(cancel));
//! //!
//! let message_handler = Update::filter_message() //! let message_handler = Update::filter_message()
//! .branch(command_handler) //! .branch(command_handler)
//! .branch(dptree::case![State::ReceiveFullName].endpoint(receive_full_name)) //! .branch(case![State::ReceiveFullName].endpoint(receive_full_name))
//! .branch(dptree::endpoint(invalid_state)); //! .branch(dptree::endpoint(invalid_state));
//! //!
//! let callback_query_handler = Update::filter_callback_query().branch( //! let callback_query_handler = Update::filter_callback_query().branch(
//! dptree::case![State::ReceiveProductChoice { full_name }] //! case![State::ReceiveProductChoice { full_name }]
//! .endpoint(receive_product_selection), //! .endpoint(receive_product_selection),
//! ); //! );
//! //!
//! teloxide::dispatching::dialogue::enter::<Update, InMemStorage<State>, State, _>() //! dialogue::enter::<Update, InMemStorage<State>, State, _>()
//! .branch(message_handler) //! .branch(message_handler)
//! .branch(callback_query_handler) //! .branch(callback_query_handler)
//! } //! }