diff --git a/src/world/chunk.rs b/src/world/chunk.rs index 77a543c..e52c27b 100644 --- a/src/world/chunk.rs +++ b/src/world/chunk.rs @@ -50,39 +50,6 @@ pub enum Chunk<'a> { Empty, } -/// Inner data structure of [SectionIter] -#[derive(Debug, Clone)] -enum SectionIterInner<'a> { - /// Iterator over sections of [Chunk::V1_18] - V1_18 { - /// Inner iterator into section map - iter: btree_map::Iter<'a, SectionY, (SectionV1_13<'a>, BiomesV1_18<'a>, BlockLight<'a>)>, - }, - /// Iterator over sections of [Chunk::V1_13] - V1_13 { - /// Inner iterator into section map - iter: btree_map::Iter<'a, SectionY, (SectionV1_13<'a>, BlockLight<'a>)>, - /// Chunk biome data - biomes: &'a BiomesV0<'a>, - }, - /// Iterator over sections of [Chunk::V0] - V0 { - /// Inner iterator into section map - iter: btree_map::Iter<'a, SectionY, (SectionV0<'a>, BlockLight<'a>)>, - /// Chunk biome data - biomes: &'a BiomesV0<'a>, - }, - /// Empty iterator over an unpopulated chunk ([Chunk::Empty]) - Empty, -} - -/// Iterator over the sections of a [Chunk] -#[derive(Debug, Clone)] -pub struct SectionIter<'a> { - /// Inner iterator enum - inner: SectionIterInner<'a>, -} - impl<'a> Chunk<'a> { /// Creates a new [Chunk] from a deserialized [de::Chunk] pub fn new( @@ -283,6 +250,39 @@ impl<'a, T> SectionIterTrait<'a> for T where { } +/// Inner data structure of [SectionIter] +#[derive(Debug, Clone)] +enum SectionIterInner<'a> { + /// Iterator over sections of [Chunk::V1_18] + V1_18 { + /// Inner iterator into section map + iter: btree_map::Iter<'a, SectionY, (SectionV1_13<'a>, BiomesV1_18<'a>, BlockLight<'a>)>, + }, + /// Iterator over sections of [Chunk::V1_13] + V1_13 { + /// Inner iterator into section map + iter: btree_map::Iter<'a, SectionY, (SectionV1_13<'a>, BlockLight<'a>)>, + /// Chunk biome data + biomes: &'a BiomesV0<'a>, + }, + /// Iterator over sections of [Chunk::V0] + V0 { + /// Inner iterator into section map + iter: btree_map::Iter<'a, SectionY, (SectionV0<'a>, BlockLight<'a>)>, + /// Chunk biome data + biomes: &'a BiomesV0<'a>, + }, + /// Empty iterator over an unpopulated chunk ([Chunk::Empty]) + Empty, +} + +/// Iterator over the sections of a [Chunk] +#[derive(Debug, Clone)] +pub struct SectionIter<'a> { + /// Inner iterator enum + inner: SectionIterInner<'a>, +} + impl<'a> SectionIter<'a> { /// Helper to run a closure on the inner section iterator fn with_iter(&mut self, f: F) -> T