Macro blaze_pk::packet

source ·
macro_rules! packet {
    (
        struct $name:ident {
            $(
                $tag: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 group because they require extra bytes)

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

Example Usage


use blaze_pk::{packet, Blob};

packet! {
    struct Test {
        TEST test: u16,
        ALT alt: String,
        BYT byt: Vec<u8>
    }
}

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