-
Notifications
You must be signed in to change notification settings - Fork 18
Open
Description
I have a use case to parse a small packet to enum. The selector is the first byte. From the documentation I must implement something like:
#[derive(Nom)]
struct PacketParser {
code: u8,
#[nom(Parse = "{ |i| PacketType::parse(i, code) }")]
packet: PacketType,
}
#[derive(Nom)]
enum PacketType {
....
}
It's very hard to handle the enum nested in enum case due to the selector introduced in the parse function prototype. I need a way to parse PacketType and specifying the Selector is the first byte. And PacketType::parse don't need the second parameter as the selector since the information is encoded in the first byte of packet.
Metadata
Metadata
Assignees
Labels
No labels