From 117094e9d0388959fb4229199ec7d63686059395 Mon Sep 17 00:00:00 2001 From: Temirkhan Myrzamadi Date: Mon, 30 Dec 2019 17:27:30 +0600 Subject: [PATCH] Improve docs of FilterDispatcher --- src/dispatching/dispatchers/filter.rs | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/dispatching/dispatchers/filter.rs b/src/dispatching/dispatchers/filter.rs index d00de234..5abbf159 100644 --- a/src/dispatching/dispatchers/filter.rs +++ b/src/dispatching/dispatchers/filter.rs @@ -16,14 +16,19 @@ type FiltersWithHandlers<'a, T, E> = Vec>; /// A dispatcher based on filters. /// -/// This is 'filter' implementation with following limitations: -/// - Error (`E` generic parameter) _must_ implement [`std::fmt::Debug`] -/// - All 'handlers' are boxed -/// - Handler's fututres are also boxed -/// - All handlers executed in order (this means that in dispatching have 2 -/// upadtes it will first execute some handler into complition with first -/// update and **then** search for handler for second update, this is probably -/// wrong) +/// Filters and handlers are executed in order of registering. The pseudocode +/// looks like this: +/// +/// ``` +/// for pair in handlers_and_filters { +/// if pair.filter.test(update) { +/// pair.handle(update); +/// return; +/// } +/// } +/// +/// log("unhandeled update: " + update); +/// ``` /// /// ## Examples ///