work
This commit is contained in:
@@ -26,7 +26,7 @@ impl From<ClientMsgInst> for ClientMsg {
|
||||
impl From<ServerMsg> for ServerMsgInst {
|
||||
fn from(value: ServerMsg) -> Self {
|
||||
match value {
|
||||
ServerMsg::AccountCreated(v) => Self::AccountCreatedV0(v),
|
||||
ServerMsg::CreateAccount(v) => Self::CreateAccountV0(v),
|
||||
ServerMsg::LoadMsg(v) => Self::LoadMsgV0(v),
|
||||
ServerMsg::LoadMsgs(v) => Self::LoadMsgsV0(v),
|
||||
ServerMsg::ServerError(v) => Self::ServerErrorV0(v),
|
||||
@@ -37,7 +37,7 @@ impl From<ServerMsg> for ServerMsgInst {
|
||||
impl From<ServerMsgInst> for ServerMsg {
|
||||
fn from(value: ServerMsgInst) -> Self {
|
||||
match value {
|
||||
ServerMsgInst::AccountCreatedV0(v) => Self::AccountCreated(v),
|
||||
ServerMsgInst::CreateAccountV0(v) => Self::CreateAccount(v),
|
||||
ServerMsgInst::LoadMsgV0(v) => Self::LoadMsg(v),
|
||||
ServerMsgInst::LoadMsgsV0(v) => Self::LoadMsgs(v),
|
||||
ServerMsgInst::ServerErrorV0(v) => Self::ServerError(v),
|
||||
|
||||
@@ -11,7 +11,7 @@ pub enum ClientMsgInst {
|
||||
#[repr(u32)]
|
||||
#[derive(Debug, bitcode::Encode, bitcode::Decode)]
|
||||
pub enum ServerMsgInst {
|
||||
AccountCreatedV0(AccountCreatedV0) = 0,
|
||||
CreateAccountV0(CreateAccountRespV0) = 0,
|
||||
LoadMsgV0(LoadMsgV0) = 1,
|
||||
LoadMsgsV0(Vec<LoadMsgV0>) = 2,
|
||||
ServerErrorV0(ServerErrorV0) = 3,
|
||||
@@ -28,7 +28,11 @@ pub struct CreateAccountV0 {
|
||||
}
|
||||
|
||||
#[derive(Debug, bitcode::Encode, bitcode::Decode)]
|
||||
pub struct AccountCreatedV0 {}
|
||||
pub enum CreateAccountRespV0 {
|
||||
Ok { id: UserIdV0 },
|
||||
UsernameExists,
|
||||
InvalidToken,
|
||||
}
|
||||
|
||||
#[derive(Debug, bitcode::Encode, bitcode::Decode)]
|
||||
pub struct LoginKeyV0(Vec<u8>);
|
||||
@@ -64,7 +68,4 @@ pub struct LoadMsgV0 {
|
||||
#[derive(Debug, bitcode::Encode, bitcode::Decode)]
|
||||
pub enum ServerErrorV0 {
|
||||
NotLoggedIn,
|
||||
UnknownUsername,
|
||||
InvalidPassword,
|
||||
UsernameTaken,
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ pub enum ClientMsg {
|
||||
|
||||
#[derive(Debug)]
|
||||
pub enum ServerMsg {
|
||||
AccountCreated(AccountCreated),
|
||||
CreateAccount(CreateAccountResp),
|
||||
LoadMsg(LoadMsg),
|
||||
LoadMsgs(Vec<LoadMsg>),
|
||||
ServerError(ServerError),
|
||||
@@ -20,7 +20,7 @@ pub type SendMsg = SendMsgV0;
|
||||
pub type LoadMsg = LoadMsgV0;
|
||||
pub type ServerError = ServerErrorV0;
|
||||
pub type CreateAccount = CreateAccountV0;
|
||||
pub type AccountCreated = AccountCreatedV0;
|
||||
pub type CreateAccountResp = CreateAccountRespV0;
|
||||
pub type UserId = UserIdV0;
|
||||
|
||||
impl From<CreateAccount> for ClientMsg {
|
||||
@@ -41,8 +41,8 @@ impl From<LoadMsg> for ServerMsg {
|
||||
}
|
||||
}
|
||||
|
||||
impl From<AccountCreated> for ServerMsg {
|
||||
fn from(value: AccountCreated) -> Self {
|
||||
Self::AccountCreated(value)
|
||||
impl From<CreateAccountResp> for ServerMsg {
|
||||
fn from(value: CreateAccountResp) -> Self {
|
||||
Self::CreateAccount(value)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user