Skip to content

schema: replace opcode constants with #[repr(u8)] enum#11

Merged
Georgiy-Tugai merged 1 commit intoforest-rs:mainfrom
Georgiy-Tugai:opcode-enum
May 4, 2026
Merged

schema: replace opcode constants with #[repr(u8)] enum#11
Georgiy-Tugai merged 1 commit intoforest-rs:mainfrom
Georgiy-Tugai:opcode-enum

Conversation

@Georgiy-Tugai
Copy link
Copy Markdown
Collaborator

Replace the 20 pub const OP_*: u8 constants with a #[non_exhaustive] #[repr(u8)] enum Opcode, giving type-safe opcode handling throughout the compiler and runtime. The enum carries bytes(), Display, TryFrom<u8>, and derived Debug so the standalone opcode_len and opcode_name functions are removed.

Replace the 20 `pub const OP_*: u8` constants with a
`#[non_exhaustive] #[repr(u8)] enum Opcode`, giving type-safe opcode
handling throughout the compiler and runtime. The enum carries
`bytes()`, `Display`, `TryFrom<u8>`, and derived `Debug` so the
standalone `opcode_len` and `opcode_name` functions are removed.
@Georgiy-Tugai Georgiy-Tugai merged commit d53e0a2 into forest-rs:main May 4, 2026
15 checks passed
@Georgiy-Tugai Georgiy-Tugai deleted the opcode-enum branch May 4, 2026 14:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants