diff --git a/src/dispatcher/filter/error_policy.rs b/src/dispatching/filter/error_policy.rs similarity index 100% rename from src/dispatcher/filter/error_policy.rs rename to src/dispatching/filter/error_policy.rs diff --git a/src/dispatcher/filter/mod.rs b/src/dispatching/filter/mod.rs similarity index 98% rename from src/dispatcher/filter/mod.rs rename to src/dispatching/filter/mod.rs index b6cf7205..6645b41e 100644 --- a/src/dispatcher/filter/mod.rs +++ b/src/dispatching/filter/mod.rs @@ -23,7 +23,7 @@ type Handlers<'a, T, E> = /// - Handler's fututres are also boxed /// - [Custom error policy] is also boxed /// - All errors from [updater] are ignored (TODO: remove this limitation) -/// - All handlers executed in order (this means that in dispatcher have 2 +/// - 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) @@ -37,7 +37,7 @@ type Handlers<'a, T, E> = /// async fn run() { /// use std::convert::Infallible; /// use telebofr::{ -/// dispatcher::{ +/// dispatching::{ /// filter::{error_policy::ErrorPolicy, FilterDispatcher}, /// updater::polling, /// }, @@ -49,7 +49,7 @@ type Handlers<'a, T, E> = /// /// let bot = Bot::new("TOKEN"); /// -/// // create dispatcher which handlers can't fail +/// // create dispatching which handlers can't fail /// // with error policy that just ignores all errors (that can't ever happen) /// let mut dp = FilterDispatcher::::new(ErrorPolicy::Ignore) /// // Add 'handler' that will handle all messages sent to the bot @@ -67,8 +67,8 @@ type Handlers<'a, T, E> = /// /// [`std::fmt::Debug`]: std::fmt::Debug /// [Custom error policy]: -/// crate::dispatcher::filter::error_policy::ErrorPolicy::Custom [updater]: -/// crate::dispatcher::updater +/// crate::dispatching::filter::error_policy::ErrorPolicy::Custom [updater]: +/// crate::dispatching::updater pub struct FilterDispatcher<'a, E> { message_handlers: Handlers<'a, Message, E>, edited_message_handlers: Handlers<'a, Message, E>, diff --git a/src/dispatcher/filter.rs b/src/dispatching/filters.rs similarity index 86% rename from src/dispatcher/filter.rs rename to src/dispatching/filters.rs index bcb59f16..6317a2e3 100644 --- a/src/dispatcher/filter.rs +++ b/src/dispatching/filters.rs @@ -6,7 +6,7 @@ pub trait Filter { } /// ``` -/// use telebofr::dispatcher::filter::Filter; +/// use telebofr::dispatching::filter::Filter; /// /// let closure = |i: &i32| -> bool { *i >= 42 }; /// assert!(closure.test(&42)); @@ -22,7 +22,7 @@ impl bool> Filter for F { } /// ``` -/// use telebofr::dispatcher::filter::Filter; +/// use telebofr::dispatching::filter::Filter; /// /// assert!(true.test(&())); /// assert_eq!(false.test(&()), false); @@ -42,7 +42,7 @@ impl Filter for bool { /// /// ## Examples /// ``` -/// use telebofr::dispatcher::filter::{And, Filter}; +/// use telebofr::dispatching::filter::{And, Filter}; /// /// // Note: bool can be treated as `Filter` that always return self. /// assert_eq!(And::new(true, false).test(&()), false); @@ -73,13 +73,13 @@ where /// /// ## Examples /// ``` -/// use telebofr::dispatcher::filter::{and, Filter}; +/// use telebofr::dispatching::filter::{and, Filter}; /// /// assert!(and(true, true).test(&())); /// assert_eq!(and(true, false).test(&()), false); /// ``` /// -/// [`And::new`]: crate::dispatcher::filter::And::new +/// [`And::new`]: crate::dispatching::filter::And::new pub fn and(a: A, b: B) -> And { And::new(a, b) } @@ -93,7 +93,7 @@ pub fn and(a: A, b: B) -> And { /// /// ## Examples /// ``` -/// use telebofr::dispatcher::filter::{Filter, Or}; +/// use telebofr::dispatching::filter::{Filter, Or}; /// /// // Note: bool can be treated as `Filter` that always return self. /// assert!(Or::new(true, false).test(&())); @@ -124,13 +124,13 @@ where /// /// ## Examples /// ``` -/// use telebofr::dispatcher::filter::{or, Filter}; +/// use telebofr::dispatching::filter::{or, Filter}; /// /// assert!(or(true, false).test(&())); /// assert_eq!(or(false, false).test(&()), false); /// ``` /// -/// [`Or::new`]: crate::dispatcher::filter::Or::new +/// [`Or::new`]: crate::dispatching::filter::Or::new pub fn or(a: A, b: B) -> Or { Or::new(a, b) } @@ -141,7 +141,7 @@ pub fn or(a: A, b: B) -> Or { /// /// ## Examples /// ``` -/// use telebofr::dispatcher::filter::{Filter, Not}; +/// use telebofr::dispatching::filter::{Filter, Not}; /// /// // Note: bool can be treated as `Filter` that always return self. /// assert!(Not::new(false).test(&())); @@ -169,13 +169,13 @@ where /// /// ## Examples /// ``` -/// use telebofr::dispatcher::filter::{not, Filter}; +/// use telebofr::dispatching::filter::{not, Filter}; /// /// assert!(not(false).test(&())); /// assert_eq!(not(true).test(&()), false); /// ``` /// -/// [`Not::new`]: crate::dispatcher::filter::Not::new +/// [`Not::new`]: crate::dispatching::filter::Not::new pub fn not(a: A) -> Not { Not::new(a) } @@ -187,7 +187,7 @@ pub fn not(a: A) -> Not { /// /// ## Examples /// ``` -/// use telebofr::{all, dispatcher::filter::Filter}; +/// use telebofr::{all, dispatching::filter::Filter}; /// /// assert!(all![true].test(&())); /// assert!(all![true, true].test(&())); @@ -199,7 +199,7 @@ pub fn not(a: A) -> Not { /// assert_eq!(all![false, false].test(&()), false); /// ``` /// -/// [filter]: crate::dispatcher::filter::Filter +/// [filter]: crate::dispatching::filter::Filter #[macro_export] macro_rules! all { ($one:expr) => { $one }; @@ -218,7 +218,7 @@ macro_rules! all { /// /// ## Examples /// ``` -/// use telebofr::{any, dispatcher::filter::Filter}; +/// use telebofr::{any, dispatching::filter::Filter}; /// /// assert!(any![true].test(&())); /// assert!(any![true, true].test(&())); @@ -230,7 +230,7 @@ macro_rules! all { /// assert_eq!(any![false, false, false].test(&()), false); /// ``` /// -/// [filter]: crate::dispatcher::filter::Filter +/// [filter]: crate::dispatching::filter::Filter #[macro_export] macro_rules! any { ($one:expr) => { $one }; @@ -246,7 +246,7 @@ macro_rules! any { /// /// ## Examples /// ``` -/// use telebofr::dispatcher::filter::{f, And, Filter, Or, F}; +/// use telebofr::dispatching::filter::{f, And, Filter, Or, F}; /// /// let flt1 = |i: &i32| -> bool { *i > 17 }; /// let flt2 = |i: &i32| -> bool { *i < 42 }; @@ -277,7 +277,7 @@ pub struct F(A); /// Constructor fn for [F] /// -/// [F]: crate::dispatcher::filter::F; +/// [F]: crate::dispatching::filter::F; pub fn f(a: A) -> F { F(a) } @@ -314,7 +314,7 @@ pub trait FilterExt { /// /// ## Examples /// ``` - /// use telebofr::dispatcher::filter::{Filter, FilterExt}; + /// use telebofr::dispatching::filter::{Filter, FilterExt}; /// /// let flt = |i: &i32| -> bool { *i > 0 }; /// let flt = flt.not(); @@ -322,7 +322,7 @@ pub trait FilterExt { /// assert_eq!(flt.test(&1), false); /// ``` /// - /// [`Not::new`]: crate::dispatcher::filter::Not::new + /// [`Not::new`]: crate::dispatching::filter::Not::new fn not(self) -> Not where Self: Sized, @@ -334,7 +334,7 @@ pub trait FilterExt { /// /// ## Examples /// ``` - /// use telebofr::dispatcher::filter::{Filter, FilterExt}; + /// use telebofr::dispatching::filter::{Filter, FilterExt}; /// /// let flt = |i: &i32| -> bool { *i > 0 }; /// let flt = flt.and(|i: &i32| *i < 42); @@ -344,7 +344,7 @@ pub trait FilterExt { /// assert_eq!(flt.test(&43), false); /// ``` /// - /// [`Not::new`]: crate::dispatcher::filter::And::new + /// [`Not::new`]: crate::dispatching::filter::And::new fn and(self, other: B) -> And where Self: Sized, @@ -356,7 +356,7 @@ pub trait FilterExt { /// /// ## Examples /// ``` - /// use telebofr::dispatcher::filter::{Filter, FilterExt}; + /// use telebofr::dispatching::filter::{Filter, FilterExt}; /// /// let flt = |i: &i32| -> bool { *i < 0 }; /// let flt = flt.or(|i: &i32| *i > 42); @@ -366,7 +366,7 @@ pub trait FilterExt { /// assert_eq!(flt.test(&17), false); /// ``` /// - /// [`Not::new`]: crate::dispatcher::filter::Or::new + /// [`Not::new`]: crate::dispatching::filter::Or::new fn or(self, other: B) -> Or where Self: Sized, diff --git a/src/dispatcher/handler.rs b/src/dispatching/handler.rs similarity index 100% rename from src/dispatcher/handler.rs rename to src/dispatching/handler.rs diff --git a/src/dispatcher/mod.rs b/src/dispatching/mod.rs similarity index 87% rename from src/dispatcher/mod.rs rename to src/dispatching/mod.rs index c13fb8b9..6c5cc912 100644 --- a/src/dispatcher/mod.rs +++ b/src/dispatching/mod.rs @@ -4,9 +4,9 @@ use async_trait::async_trait; pub use filter::Filter; pub use handler::Handler; -pub mod filter; +pub mod filters; pub mod handler; -pub mod filter; +pub mod filters; pub mod updater; #[async_trait(? Send)] diff --git a/src/dispatcher/updater.rs b/src/dispatching/updater.rs similarity index 100% rename from src/dispatcher/updater.rs rename to src/dispatching/updater.rs diff --git a/src/lib.rs b/src/lib.rs index 533071c7..838a211a 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -12,6 +12,6 @@ mod errors; mod network; mod bot; -pub mod dispatcher; +pub mod dispatching; pub mod requests; pub mod types;