55 lines
2.0 KiB
Rust
55 lines
2.0 KiB
Rust
use crate::net::{
|
|
ClientMsg, ServerMsg,
|
|
data::{ClientMsgInst, ServerMsgInst},
|
|
};
|
|
|
|
impl From<ClientMsg> for ClientMsgInst {
|
|
fn from(value: ClientMsg) -> Self {
|
|
match value {
|
|
ClientMsg::CreateAccount(v) => Self::CreateAccountV0(v),
|
|
ClientMsg::RequestMsgs => Self::RequestMsgsV0,
|
|
ClientMsg::SendMsg(v) => Self::SendMsgV0(v),
|
|
ClientMsg::Login(v) => Self::LoginV0(v),
|
|
ClientMsg::RequestUsers(v) => Self::RequestUsersV0(v),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<ClientMsgInst> for ClientMsg {
|
|
fn from(value: ClientMsgInst) -> Self {
|
|
match value {
|
|
ClientMsgInst::CreateAccountV0(v) => Self::CreateAccount(v),
|
|
ClientMsgInst::RequestMsgsV0 => Self::RequestMsgs,
|
|
ClientMsgInst::SendMsgV0(v) => Self::SendMsg(v),
|
|
ClientMsgInst::LoginV0(v) => Self::Login(v),
|
|
ClientMsgInst::RequestUsersV0(v) => Self::RequestUsers(v),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<ServerMsg> for ServerMsgInst {
|
|
fn from(value: ServerMsg) -> Self {
|
|
match value {
|
|
ServerMsg::CreateAccountResp(v) => Self::CreateAccountRespV0(v),
|
|
ServerMsg::LoadMsg(v) => Self::LoadMsgV0(v),
|
|
ServerMsg::LoadMsgs(v) => Self::LoadMsgsV0(v),
|
|
ServerMsg::ServerError(v) => Self::ServerErrorV0(v),
|
|
ServerMsg::LoginResp(v) => Self::LoginRespV0(v),
|
|
ServerMsg::RequestUsersResp(v) => Self::RequestUsersRespV0(v),
|
|
}
|
|
}
|
|
}
|
|
|
|
impl From<ServerMsgInst> for ServerMsg {
|
|
fn from(value: ServerMsgInst) -> Self {
|
|
match value {
|
|
ServerMsgInst::CreateAccountRespV0(v) => Self::CreateAccountResp(v),
|
|
ServerMsgInst::LoadMsgV0(v) => Self::LoadMsg(v),
|
|
ServerMsgInst::LoadMsgsV0(v) => Self::LoadMsgs(v),
|
|
ServerMsgInst::ServerErrorV0(v) => Self::ServerError(v),
|
|
ServerMsgInst::LoginRespV0(v) => Self::LoginResp(v),
|
|
ServerMsgInst::RequestUsersRespV0(v) => Self::RequestUsersResp(v),
|
|
}
|
|
}
|
|
}
|