1
0
Fork 0
mirror of https://github.com/azalea-rs/simdnbt.git synced 2025-08-02 07:26:04 +00:00

better ParsingStackElement enum ordering

This commit is contained in:
mat 2024-07-15 23:01:33 +00:00
parent b71d67e5b1
commit 2598d94ca9
2 changed files with 4 additions and 3 deletions

View file

@ -236,8 +236,8 @@ impl<'a: 'tape, 'tape> Iterator for CompoundIter<'a, 'tape> {
#[derive(Debug, Copy, Clone)]
pub(crate) enum ParsingStackElement {
Compound { index_of_compound_element: u32 },
ListOfLists { index_of_list_element: u32 },
ListOfCompounds { index_of_list_element: u32 },
ListOfLists { index_of_list_element: u32 },
}
pub struct ParsingStack {

View file

@ -147,12 +147,13 @@ fn read_with_stack<'a>(
stack: &mut ParsingStack,
) -> Result<(), Error> {
while !stack.is_empty() {
match stack.peek_mut() {
let top = stack.peek_mut();
match top {
ParsingStackElement::Compound { .. } => read_tag_in_compound(data, tapes, stack)?,
ParsingStackElement::ListOfLists { .. } => read_list_in_list(data, tapes, stack)?,
ParsingStackElement::ListOfCompounds { .. } => {
read_compound_in_list(data, tapes, stack)?
}
ParsingStackElement::ListOfLists { .. } => read_list_in_list(data, tapes, stack)?,
}
}