Remove Arc from dialogues_repl

This commit is contained in:
Temirkhan Myrzamadi 2020-07-31 16:16:14 +06:00
parent 9115622ee3
commit 3e01e0f65f

View file

@ -1,17 +1,15 @@
use crate::{ use crate::{
dispatching::{ dispatching::{
dialogue::{DialogueDispatcher, DialogueStage, DialogueWithCx, GetChatId}, dialogue::{DialogueDispatcher, DialogueStage, DialogueWithCx},
update_listeners, update_listeners,
update_listeners::UpdateListener, update_listeners::UpdateListener,
Dispatcher, DispatcherHandlerRx, DispatcherHandlerRxExt, UpdateWithCx, Dispatcher, UpdateWithCx,
}, },
error_handlers::{LoggingErrorHandler, OnError}, error_handlers::{LoggingErrorHandler, OnError},
types::Message, types::Message,
utils::command::BotCommand,
Bot, Bot,
}; };
use futures::StreamExt; use std::{convert::Infallible, fmt::Debug, future::Future};
use std::{convert::Infallible, fmt::Debug, future::Future, sync::Arc};
/// A [REPL] for dialogues. /// A [REPL] for dialogues.
/// ///
@ -74,8 +72,6 @@ pub async fn dialogues_repl_with_listener<'a, H, D, Fut, L, ListenerE, HandlerE>
Result<DialogueStage<D>, HandlerE>: OnError<HandlerE>, Result<DialogueStage<D>, HandlerE>: OnError<HandlerE>,
HandlerE: Debug + Send, HandlerE: Debug + Send,
{ {
let handler = Arc::new(handler);
Dispatcher::new(bot) Dispatcher::new(bot)
.messages_handler(DialogueDispatcher::new( .messages_handler(DialogueDispatcher::new(
|DialogueWithCx { cx, dialogue }: DialogueWithCx<Message, D, Infallible>| async move { |DialogueWithCx { cx, dialogue }: DialogueWithCx<Message, D, Infallible>| async move {