Skip to content

Utilize Rust Macros #5

Description

@john-bv

Issue / Question:
We should utilize rust Macros.

Relevance:
Rust macros would save us time when writing protocol implementation, for instance, instead of repeatedly writing implementations for ProtocolEncoder/Decoder we can utilize macros, which will be able to do this for us.

Solution:

#[mcpe_packet(1)]
pub struct LoginPacket {
	pub protocol: u8;
	pub data: BinaryStream;
}

or more advanced:

#[derive(encoder, decoder)]
pub struct BehaviorPack {
	... props
}
#[mcpe_packet(7, "custom")]
pub struct ResourcePacksInfo {
	pub required: bool,
	pub has_scripts: bool,
	pub bpacks: Vec<BehaviorPack>
}

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestgood first issueGood for newcomershelp wantedExtra attention is neededquestionFurther information is requested

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions