Fix all the errors

This commit is contained in:
Temirkhan Myrzamadi 2019-12-30 22:35:22 +06:00
parent e815c0945d
commit d750e1c3dc

View file

@ -19,7 +19,7 @@ type FiltersWithHandlers<'a, T, E> = Vec<FilterWithHandler<'a, T, E>>;
/// Filters and handlers are executed in order of registering. The pseudocode /// Filters and handlers are executed in order of registering. The pseudocode
/// looks like this: /// looks like this:
/// ///
/// ``` /// ```no
/// for pair in handlers_and_filters { /// for pair in handlers_and_filters {
/// if pair.filter.test(update) { /// if pair.filter.test(update) {
/// pair.handle(update); /// pair.handle(update);
@ -39,17 +39,15 @@ type FiltersWithHandlers<'a, T, E> = Vec<FilterWithHandler<'a, T, E>>;
/// ///
/// use teloxide::{ /// use teloxide::{
/// dispatching::{ /// dispatching::{
/// dispatchers::filter::{ /// dispatchers::filter::FilterDispatcher, updaters::polling_basic,
/// error_policy::ErrorPolicy, FilterDispatcher,
/// },
/// updater::polling,
/// }, /// },
/// types::Message, /// types::Message,
/// Bot, /// Bot,
/// }; /// };
/// ///
/// async fn handle_edited_message(mes: Message) { /// async fn handle_edited_message(mes: Message) -> Result<(), Infallible> {
/// println!("Edited message: {:?}", mes) /// println!("Edited message: {:?}", mes);
/// Ok(())
/// } /// }
/// ///
/// let bot = Bot::new("TOKEN"); /// let bot = Bot::new("TOKEN");
@ -59,14 +57,15 @@ type FiltersWithHandlers<'a, T, E> = Vec<FilterWithHandler<'a, T, E>>;
/// let mut dp = FilterDispatcher::<Infallible, _>::new(|_| async {}) /// let mut dp = FilterDispatcher::<Infallible, _>::new(|_| async {})
/// // Add 'handler' that will handle all messages sent to the bot /// // Add 'handler' that will handle all messages sent to the bot
/// .message_handler(true, |mes: Message| async move { /// .message_handler(true, |mes: Message| async move {
/// println!("New message: {:?}", mes) /// println!("New message: {:?}", mes);
/// Ok(())
/// }) /// })
/// // Add 'handler' that will handle all /// // Add 'handler' that will handle all
/// // messages edited in chat with the bot /// // messages edited in chat with the bot
/// .edited_message_handler(true, handle_edited_message); /// .edited_message_handler(true, handle_edited_message);
/// ///
/// // Start dispatching updates from long polling /// // Start dispatching updates from long polling
/// dp.dispatch(polling(&bot)).await; /// dp.dispatch(polling_basic(&bot)).await;
/// # } /// # }
/// ``` /// ```
/// ///
@ -319,6 +318,7 @@ mod tests {
let mut dp = FilterDispatcher::<Infallible, _>::new(|_| async {}) let mut dp = FilterDispatcher::<Infallible, _>::new(|_| async {})
.message_handler(true, |_mes: Message| async move { .message_handler(true, |_mes: Message| async move {
counter.fetch_add(1, Ordering::SeqCst); counter.fetch_add(1, Ordering::SeqCst);
Ok::<_, Infallible>(())
}) })
.message_handler(true, |_mes: Message| async move { .message_handler(true, |_mes: Message| async move {
counter2.fetch_add(1, Ordering::SeqCst); counter2.fetch_add(1, Ordering::SeqCst);