This commit is contained in:
Sijmen 2023-11-06 12:49:39 +01:00
parent dd55f8c623
commit 61b5fb1aa7

View file

@ -74,7 +74,7 @@ struct CriFlags {
#[derive(Debug, Clone)] #[derive(Debug, Clone)]
enum Message { enum Message {
IrcMessageReceived(irc::proto::Message), IrcMessageReceived(Box<irc::proto::Message>),
InputChanged(String), InputChanged(String),
InputSubmitted, InputSubmitted,
} }
@ -103,7 +103,7 @@ impl Application for Cri {
fn update(&mut self, message: Self::Message) -> iced::Command<Self::Message> { fn update(&mut self, message: Self::Message) -> iced::Command<Self::Message> {
match message { match message {
Message::IrcMessageReceived(message) => self.message_log.push(message), Message::IrcMessageReceived(message) => self.message_log.push(*message),
Message::InputChanged(text) => self.input_value = text, Message::InputChanged(text) => self.input_value = text,
Message::InputSubmitted => { Message::InputSubmitted => {
let command = let command =
@ -125,7 +125,7 @@ impl Application for Cri {
self.message_rx.take(), self.message_rx.take(),
move |mut receiver| async move { move |mut receiver| async move {
let message = receiver.as_mut().unwrap().recv().await.unwrap(); let message = receiver.as_mut().unwrap().recv().await.unwrap();
(Message::IrcMessageReceived(message), receiver) (Message::IrcMessageReceived(Box::new(message)), receiver)
}, },
) )
} }