65 lines
1.3 KiB
Rust
65 lines
1.3 KiB
Rust
use super::data::*;
|
|
|
|
#[derive(Debug)]
|
|
pub enum ClientMsg {
|
|
CreateAccount(CreateAccount),
|
|
Login(Login),
|
|
RequestMsgs,
|
|
SendMsg(SendMsg),
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
pub enum ServerMsg {
|
|
CreateAccountResp(CreateAccountResp),
|
|
LoginResp(LoginResp),
|
|
LoadMsg(LoadMsg),
|
|
LoadMsgs(Vec<LoadMsg>),
|
|
ServerError(ServerError),
|
|
}
|
|
|
|
pub type LoginKey = LoginKeyV0;
|
|
pub type SendMsg = SendMsgV0;
|
|
pub type LoadMsg = LoadMsgV0;
|
|
pub type ServerError = ServerErrorV0;
|
|
pub type CreateAccount = CreateAccountV0;
|
|
pub type CreateAccountResp = CreateAccountRespV0;
|
|
pub type Login = LoginV0;
|
|
pub type LoginResp = LoginRespV0;
|
|
pub type UserId = UserIdV0;
|
|
|
|
impl From<CreateAccount> for ClientMsg {
|
|
fn from(value: CreateAccount) -> Self {
|
|
Self::CreateAccount(value)
|
|
}
|
|
}
|
|
|
|
impl From<Login> for ClientMsg {
|
|
fn from(value: Login) -> Self {
|
|
Self::Login(value)
|
|
}
|
|
}
|
|
|
|
impl From<ServerError> for ServerMsg {
|
|
fn from(value: ServerError) -> Self {
|
|
Self::ServerError(value)
|
|
}
|
|
}
|
|
|
|
impl From<LoadMsg> for ServerMsg {
|
|
fn from(value: LoadMsg) -> Self {
|
|
Self::LoadMsg(value)
|
|
}
|
|
}
|
|
|
|
impl From<CreateAccountResp> for ServerMsg {
|
|
fn from(value: CreateAccountResp) -> Self {
|
|
Self::CreateAccountResp(value)
|
|
}
|
|
}
|
|
|
|
impl From<LoginResp> for ServerMsg {
|
|
fn from(value: LoginResp) -> Self {
|
|
Self::LoginResp(value)
|
|
}
|
|
}
|