use crate::entities::user::User;
use actix::prelude::*;
pub type JoinResult = Result<super::Handle, JoinError>;
#[derive(Message)]
#[rtype(result = "JoinResult")]
pub struct Join {
pub channel_name: String,
pub nick: String,
pub user: Addr<User>,
}
#[derive(Debug, thiserror::Error, displaydoc::Display)]
pub enum JoinError {
Mailbox(#[from] actix::MailboxError),
}
#[derive(Message)]
#[rtype(result = "")]
pub struct JoinBroadcast {
pub channel_name: String,
pub nick: String,
}
impl From<Join> for JoinBroadcast {
fn from(
Join {
channel_name, nick, ..
}: Join,
) -> Self {
Self { channel_name, nick }
}
}