This commit is contained in:
2026-01-26 13:53:51 -05:00
parent e1eff49be9
commit 53ed4775ae
19 changed files with 565 additions and 350 deletions

46
src/net/conversion.rs Normal file
View File

@@ -0,0 +1,46 @@
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),
}
}
}
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),
}
}
}
impl From<ServerMsg> for ServerMsgInst {
fn from(value: ServerMsg) -> Self {
match value {
ServerMsg::AccountCreated(v) => Self::AccountCreatedV0(v),
ServerMsg::LoadMsg(v) => Self::LoadMsgV0(v),
ServerMsg::LoadMsgs(v) => Self::LoadMsgsV0(v),
ServerMsg::ServerError(v) => Self::ServerErrorV0(v),
}
}
}
impl From<ServerMsgInst> for ServerMsg {
fn from(value: ServerMsgInst) -> Self {
match value {
ServerMsgInst::AccountCreatedV0(v) => Self::AccountCreated(v),
ServerMsgInst::LoadMsgV0(v) => Self::LoadMsg(v),
ServerMsgInst::LoadMsgsV0(v) => Self::LoadMsgs(v),
ServerMsgInst::ServerErrorV0(v) => Self::ServerError(v),
}
}
}