Struct teloxide::dispatching::DispatcherBuilder
source · pub struct DispatcherBuilder<R, Err, Key> { /* private fields */ }
Expand description
The builder for Dispatcher
.
See also: “Dispatching or REPLs?”
Implementations§
source§impl<R, Err, Key> DispatcherBuilder<R, Err, Key>where
R: Clone + Requester + Send + Sync + 'static,
Err: Debug + Send + Sync + 'static,
impl<R, Err, Key> DispatcherBuilder<R, Err, Key>where
R: Clone + Requester + Send + Sync + 'static,
Err: Debug + Send + Sync + 'static,
sourcepub fn default_handler<H, Fut>(self, handler: H) -> Selfwhere
H: Fn(Arc<Update>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = ()> + Send + 'static,
pub fn default_handler<H, Fut>(self, handler: H) -> Selfwhere
H: Fn(Arc<Update>) -> Fut + Send + Sync + 'static,
Fut: Future<Output = ()> + Send + 'static,
Specifies a handler that will be called for an unhandled update.
By default, it is a mere log::warn
.
sourcepub fn error_handler(
self,
handler: Arc<dyn ErrorHandler<Err> + Send + Sync>
) -> Self
pub fn error_handler(
self,
handler: Arc<dyn ErrorHandler<Err> + Send + Sync>
) -> Self
Specifies a handler that will be called on a handler error.
By default, it is LoggingErrorHandler
.
sourcepub fn dependencies(self, dependencies: DependencyMap) -> Self
pub fn dependencies(self, dependencies: DependencyMap) -> Self
Specifies dependencies that can be used inside of handlers.
By default, there is no dependencies.
sourcepub fn enable_ctrlc_handler(self) -> Self
Available on crate feature ctrlc_handler
only.
pub fn enable_ctrlc_handler(self) -> Self
ctrlc_handler
only.Enables the ^C
handler that shutdown
s dispatching.
sourcepub fn worker_queue_size(self, size: usize) -> Self
pub fn worker_queue_size(self, size: usize) -> Self
Specifies size of the queue for workers.
By default it’s 64.
sourcepub fn distribution_function<K>(
self,
f: fn(_: &Update) -> Option<K>
) -> DispatcherBuilder<R, Err, K>where
K: Hash + Eq,
pub fn distribution_function<K>(
self,
f: fn(_: &Update) -> Option<K>
) -> DispatcherBuilder<R, Err, K>where
K: Hash + Eq,
Specifies the distribution function that decides how updates are grouped before execution.
sourcepub fn build(self) -> Dispatcher<R, Err, Key>
pub fn build(self) -> Dispatcher<R, Err, Key>
Constructs Dispatcher
.