packet_struct

Macro packet_struct 

Source
macro_rules! packet_struct {
    (
            $packet_id: expr,
            $(#[$struct_meta:meta])*
            $struct_name:ident $(< $($lifetimes:lifetime),* >)? {
                $(
                    $(#[$field_meta:meta])*
                    $field_name:ident: $field_type:ty$(,)*
                )*
            },
            fn $fn:ident ($self:ident) -> $ret:ty $body:block
        ) => { ... };
    (
            $packet_id: expr,
            $(#[$struct_meta:meta])*
            $struct_name:ident $(< $($lifetimes:lifetime),* >)? {
                $(
                    $(#[$field_meta:meta])*
                    $field_name:ident: $field_type:ty$(,)*
                )*
            }
        ) => { ... };
}
Expand description

Impl bancho packet

Example

use bancho_packets::*;

packet_struct!(
    PacketId::OSU_USER_CHANGE_ACTION,
    /// #0: OSU_USER_CHANGE_ACTION
    UserChangeAction<'a> {
        online_status: u8,
        description: CowStr<'a>,
        beatmap_md5: CowStr<'a>,
        mods: u32,
        mode: u8,
        beatmap_id: i32,
    }
);