rust/hedgewars-server/src/handlers.rs
changeset 15102 80ff12edf5e6
parent 15075 e935b1ad23f3
child 15103 823052e66611
equal deleted inserted replaced
15101:f772013867e7 15102:80ff12edf5e6
    28 mod inlobby;
    28 mod inlobby;
    29 mod inroom;
    29 mod inroom;
    30 
    30 
    31 use std::fmt::{Formatter, LowerHex};
    31 use std::fmt::{Formatter, LowerHex};
    32 
    32 
    33 #[derive(PartialEq)]
    33 #[derive(PartialEq, Debug)]
    34 pub struct Sha1Digest([u8; 20]);
    34 pub struct Sha1Digest([u8; 20]);
    35 
    35 
    36 impl Sha1Digest {
    36 impl Sha1Digest {
    37     pub fn new(digest: [u8; 20]) -> Self {
    37     pub fn new(digest: [u8; 20]) -> Self {
    38         Self(digest)
    38         Self(digest)
    46         }
    46         }
    47         Ok(())
    47         Ok(())
    48     }
    48     }
    49 }
    49 }
    50 
    50 
       
    51 #[derive(Debug)]
    51 pub struct AccountInfo {
    52 pub struct AccountInfo {
    52     pub is_registered: bool,
    53     pub is_registered: bool,
    53     pub is_admin: bool,
    54     pub is_admin: bool,
    54     pub is_contributor: bool,
    55     pub is_contributor: bool,
    55     pub server_hash: Sha1Digest,
    56     pub server_hash: Sha1Digest,
    75         room_id: RoomId,
    76         room_id: RoomId,
    76         filename: String,
    77         filename: String,
    77     },
    78     },
    78 }
    79 }
    79 
    80 
       
    81 #[derive(Debug)]
    80 pub enum IoResult {
    82 pub enum IoResult {
    81     Account(Option<AccountInfo>),
    83     Account(Option<AccountInfo>),
    82     Replay(Option<Replay>),
    84     Replay(Option<Replay>),
    83     SaveRoom(RoomId, bool),
    85     SaveRoom(RoomId, bool),
    84     LoadRoom(RoomId, Option<String>),
    86     LoadRoom(RoomId, Option<String>),