diff --git a/media/FILTER_DP_FLOWCHART.png b/media/FILTER_DP_FLOWCHART.png new file mode 100644 index 00000000..53641075 Binary files /dev/null and b/media/FILTER_DP_FLOWCHART.png differ diff --git a/src/dispatching/filter_dp.rs b/src/dispatching/filter_dp.rs index d6009f1a..1a62db2c 100644 --- a/src/dispatching/filter_dp.rs +++ b/src/dispatching/filter_dp.rs @@ -17,19 +17,19 @@ type FiltersWithHandlers<'a, T, E> = Vec>; /// A dispatcher based on filters. /// -/// Filters and handlers are executed in order of registering. The pseudocode -/// looks like this: +/// It consists of: +/// 1. [`ErrorHandler`] than handles errors both from [`Updater`] and +/// [`Handler`]. +/// 2. Filters and handlers. /// -/// ```no -/// for pair in handlers_and_filters { -/// if pair.filter.test(update) { -/// pair.handle(update); -/// return; -/// } -/// } +/// First you register filters and handlers using the methods defined below, and +/// then you call [`.dispatch(updater)`]. Filters and handlers are executed in +/// order of registering. The following flowchart represents how this dispatcher +/// acts: /// -/// log("unhandeled update: " + update); -/// ``` +///
+/// +///
/// /// ## Examples /// @@ -70,6 +70,7 @@ type FiltersWithHandlers<'a, T, E> = Vec>; /// /// [`std::fmt::Debug`]: std::fmt::Debug /// [updater]: crate::dispatching::updater +/// [`.dispatch(updater)`]: FilterDispatcher::dispatch pub struct FilterDispatcher<'a, E, Eh> { message_handlers: FiltersWithHandlers<'a, Message, E>, edited_message_handlers: FiltersWithHandlers<'a, Message, E>, diff --git a/src/dispatching/updaters.rs b/src/dispatching/updaters.rs index 0c5248bb..f7fed6f5 100644 --- a/src/dispatching/updaters.rs +++ b/src/dispatching/updaters.rs @@ -115,7 +115,7 @@ impl Updater for S where S: Stream> {} /// Returns a long polling updater with the default configuration. /// -/// [`polling`]: polling +/// See also: [`polling`](polling). pub fn polling_default(bot: &Bot) -> impl Updater + '_ { polling(bot, None, None, None) } @@ -129,7 +129,7 @@ pub fn polling_default(bot: &Bot) -> impl Updater + '_ { /// - `allowed_updates`: A list the types of updates you want to receive. /// See [`GetUpdates`] for defaults. /// -/// See also: [`polling_default`](polling_default) +/// See also: [`polling_default`](polling_default). /// /// [`GetUpdates`]: crate::requests::payloads::GetUpdates pub fn polling(