macro_rules! packet {
    (
        struct $name:ident {
            $(
                $field:ident: $ty:ty
            ),* $(,)?
        }

    ) => { ... };
}
Expand description

Macro for generating structures that can be encoded and decoded from bytes (DONT USE THIS FOR GROUPS USE tdf_group because they require extra bytes)

You can only use types that implement Codec the ones implemented by this library are

*Any = Any of the following types

VarInt String Vec Group (Creates with group macro) Vec<String | VarInt | Float | Group> TdfMap<String | VarInt, *Any> TdfOptional<*Any> VarIntList (VarInt, VarInt) (VarInt, VarInt, VarInt)

All field names must be in caps and no longer than 4 chars

Example Usage


use blaze_pk::{packet, VarInt};

packet! {
    struct Test {
        TEST: VarInt,
        ALT: String,
        BYT: Vec<u8>
    }
}

Generated structs can then be used as packet body’s when creating packets