mirror of
https://github.com/neocturne/MinedMap.git
synced 2025-03-04 17:23:33 +01:00
world/chunk: move SectionIter structs to impl
This commit is contained in:
parent
5273e4b366
commit
1e41e1bc6a
1 changed files with 33 additions and 33 deletions
|
@ -50,39 +50,6 @@ pub enum Chunk<'a> {
|
||||||
Empty,
|
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> {
|
impl<'a> Chunk<'a> {
|
||||||
/// Creates a new [Chunk] from a deserialized [de::Chunk]
|
/// Creates a new [Chunk] from a deserialized [de::Chunk]
|
||||||
pub fn new(
|
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> {
|
impl<'a> SectionIter<'a> {
|
||||||
/// Helper to run a closure on the inner section iterator
|
/// Helper to run a closure on the inner section iterator
|
||||||
fn with_iter<F, T>(&mut self, f: F) -> T
|
fn with_iter<F, T>(&mut self, f: F) -> T
|
||||||
|
|
Loading…
Add table
Reference in a new issue