Expose DefaultHandler, UpdateHandler out of dispatcher.rs

This commit is contained in:
Hirrolot 2022-01-16 19:50:39 +06:00
parent 2ad4e9a9f7
commit bacea51adc
2 changed files with 2 additions and 7 deletions

View file

@ -37,7 +37,7 @@ macro_rules! define_handlers {
#[must_use = "Call .dispatch() or .dispatch_with_listener() function to start dispatching."] #[must_use = "Call .dispatch() or .dispatch_with_listener() function to start dispatching."]
pub fn $func(mut self, make_handler: impl FnOnce(UpdateHandler<Err>) -> UpdateHandler<Err>) -> Self { pub fn $func(mut self, make_handler: impl FnOnce(UpdateHandler<Err>) -> UpdateHandler<Err>) -> Self {
self.allowed_updates.insert(AllowedUpdate::$update); self.allowed_updates.insert(AllowedUpdate::$update);
self.handler(make_handler(make_parser!($update))) Dispatcher { handler: self.handler.branch(make_handler(make_parser!($update))), ..self }
} }
)* )*
} }
@ -263,11 +263,6 @@ where
} }
} }
#[must_use = "Call .dispatch() or .dispatch_with_listener() function to start dispatching."]
pub fn handler(self, handler: UpdateHandler<Err>) -> Self {
Dispatcher { handler: self.handler.branch(handler), ..self }
}
#[must_use = "Call .dispatch() or .dispatch_with_listener() function to start dispatching."] #[must_use = "Call .dispatch() or .dispatch_with_listener() function to start dispatching."]
// Specify handler that will be called if other handlers was not handle the // Specify handler that will be called if other handlers was not handle the
// update. // update.

View file

@ -6,6 +6,6 @@ mod handler_ext;
mod handler_factory; mod handler_factory;
pub mod message_filter_ext; pub mod message_filter_ext;
pub use dispatcher::Dispatcher; pub use dispatcher::{DefaultHandler, Dispatcher, UpdateHandler};
pub use handler_ext::HandlerExt; pub use handler_ext::HandlerExt;
pub use handler_factory::HandlerFactory; pub use handler_factory::HandlerFactory;