#[derive(PacketLength)]
{
// Attributes available to this derive:
#[length]
}
Expand description
This derive macro will implement the BanchoPacketLength trait for the struct.
§Usage
ⓘ
use bancho_packets::{PacketLength};
#[derive(Debug, Clone, PacketLength)]
/// [`MatchData`] is the data of bancho client multiplayer game room.
pub struct MatchData {
pub match_id: i32,
pub in_progress: bool,
pub match_type: i8,
pub play_mods: u32,
pub match_name: String,
#[length(self.password.as_ref().map(|pw| pw.packet_len()).unwrap_or(2))]
pub password: Option<String>,
pub beatmap_name: String,
pub beatmap_id: i32,
pub beatmap_md5: String,
pub slot_status: Vec<u8>,
pub slot_teams: Vec<u8>,
pub slot_players: Vec<i32>,
pub host_player_id: i32,
pub match_game_mode: u8,
pub win_condition: u8,
pub team_type: u8,
pub freemods: bool,
pub player_mods: Vec<i32>,
pub match_seed: i32,
}