From 0842cb4ec2c193f0ba5a00018221ca3881d4607b Mon Sep 17 00:00:00 2001 From: Matthias Schiffer Date: Fri, 18 Aug 2023 19:20:21 +0200 Subject: [PATCH] Rename library crate to minedmap-core Rustdoc can't deal with a bin and lib crate with the same name. --- Cargo.lock | 2 +- Cargo.toml | 2 +- src/bin/minedmap/common.rs | 2 +- src/bin/minedmap/main.rs | 2 ++ src/bin/minedmap/metadata_writer.rs | 9 +++++---- src/bin/minedmap/region_processor.rs | 20 +++++++++++--------- src/bin/minedmap/tile_mipmapper.rs | 7 ++++--- src/bin/minedmap/tile_renderer.rs | 16 +++++++++------- src/bin/nbtdump.rs | 2 +- src/bin/regiondump.rs | 2 +- 10 files changed, 36 insertions(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fcf88f7..e6735e0 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -552,7 +552,7 @@ dependencies = [ ] [[package]] -name = "minedmap" +name = "minedmap-core" version = "0.1.0" dependencies = [ "anyhow", diff --git a/Cargo.toml b/Cargo.toml index 111ee92..62fcd3c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "minedmap" +name = "minedmap-core" version = "0.1.0" edition = "2021" license = "MIT" diff --git a/src/bin/minedmap/common.rs b/src/bin/minedmap/common.rs index 48cebf8..df15d99 100644 --- a/src/bin/minedmap/common.rs +++ b/src/bin/minedmap/common.rs @@ -7,7 +7,7 @@ use std::{ use indexmap::IndexSet; use serde::{Deserialize, Serialize}; -use minedmap::{io::fs::FileMetaVersion, resource::Biome, types::*, world::layer}; +use super::core::{io::fs::FileMetaVersion, resource::Biome, types::*, world::layer}; // Increase to force regeneration of all output files pub const FILE_META_VERSION: FileMetaVersion = FileMetaVersion(0); diff --git a/src/bin/minedmap/main.rs b/src/bin/minedmap/main.rs index ebeae87..046fbb5 100644 --- a/src/bin/minedmap/main.rs +++ b/src/bin/minedmap/main.rs @@ -5,6 +5,8 @@ mod region_processor; mod tile_mipmapper; mod tile_renderer; +use minedmap_core as core; + use std::path::PathBuf; use anyhow::{Context, Result}; diff --git a/src/bin/minedmap/metadata_writer.rs b/src/bin/minedmap/metadata_writer.rs index 3862362..98b086a 100644 --- a/src/bin/minedmap/metadata_writer.rs +++ b/src/bin/minedmap/metadata_writer.rs @@ -1,8 +1,10 @@ use anyhow::{Context, Result}; -use minedmap::{io::fs, world::de}; use serde::Serialize; -use super::common::*; +use super::{ + common::*, + core::{self, io::fs, world::de}, +}; #[derive(Debug, Serialize)] #[serde(rename_all = "camelCase")] @@ -77,8 +79,7 @@ impl<'a> MetadataWriter<'a> { } fn read_level_dat(&self) -> Result { - minedmap::io::data::from_file(&self.config.level_dat_path) - .context("Failed to read level.dat") + core::io::data::from_file(&self.config.level_dat_path).context("Failed to read level.dat") } fn spawn(level_dat: &de::LevelDat) -> Spawn { diff --git a/src/bin/minedmap/region_processor.rs b/src/bin/minedmap/region_processor.rs index 6aa2cb4..983aa03 100644 --- a/src/bin/minedmap/region_processor.rs +++ b/src/bin/minedmap/region_processor.rs @@ -4,18 +4,20 @@ use anyhow::{Context, Result}; use indexmap::IndexSet; use rayon::prelude::*; -use minedmap::{ - io::{fs, storage}, - resource::{self, Biome}, - types::*, - world::{ +use super::{ + common::*, + core::{ self, - layer::{self, LayerData}, + io::{fs, storage}, + resource::{self, Biome}, + types::*, + world::{ + self, + layer::{self, LayerData}, + }, }, }; -use super::common::*; - /// Parses a filename in the format r.X.Z.mca into the contained X and Z values fn parse_region_filename(file_name: &OsStr) -> Option { let parts: Vec<_> = file_name.to_str()?.split('.').collect(); @@ -136,7 +138,7 @@ impl<'a> RegionProcessor<'a> { println!("Processing region r.{}.{}.mca", coords.x, coords.z); - minedmap::io::region::from_file(path)?.foreach_chunk( + core::io::region::from_file(path)?.foreach_chunk( |chunk_coords, data: world::de::Chunk| { let Some(layer::LayerData { blocks, diff --git a/src/bin/minedmap/tile_mipmapper.rs b/src/bin/minedmap/tile_mipmapper.rs index 4a8cf63..14a2ec0 100644 --- a/src/bin/minedmap/tile_mipmapper.rs +++ b/src/bin/minedmap/tile_mipmapper.rs @@ -1,9 +1,10 @@ use anyhow::{Context, Result}; use rayon::prelude::*; -use minedmap::{io::fs, types::*}; - -use super::common::*; +use super::{ + common::*, + core::{io::fs, types::*}, +}; pub struct TileMipmapper<'a> { config: &'a Config, diff --git a/src/bin/minedmap/tile_renderer.rs b/src/bin/minedmap/tile_renderer.rs index bc59b23..409db6d 100644 --- a/src/bin/minedmap/tile_renderer.rs +++ b/src/bin/minedmap/tile_renderer.rs @@ -11,15 +11,17 @@ use lru::LruCache; use rayon::prelude::*; use tokio::sync::OnceCell; -use minedmap::{ - io::{fs, storage}, - resource::{block_color, needs_biome}, - types::*, - util::coord_offset, +use super::{ + common::*, + core::{ + io::{fs, storage}, + resource::{block_color, needs_biome}, + types::*, + util::coord_offset, + }, + region_group::RegionGroup, }; -use super::{common::*, region_group::RegionGroup}; - type RegionRef = Arc; fn biome_at( diff --git a/src/bin/nbtdump.rs b/src/bin/nbtdump.rs index d944cf2..e68c376 100644 --- a/src/bin/nbtdump.rs +++ b/src/bin/nbtdump.rs @@ -12,7 +12,7 @@ struct Args { fn main() -> Result<()> { let args = Args::parse(); - let value: fastnbt::Value = minedmap::io::data::from_file(args.file.as_path())?; + let value: fastnbt::Value = minedmap_core::io::data::from_file(args.file.as_path())?; println!("{:#x?}", value); Ok(()) diff --git a/src/bin/regiondump.rs b/src/bin/regiondump.rs index f3b7210..9dfac2f 100644 --- a/src/bin/regiondump.rs +++ b/src/bin/regiondump.rs @@ -12,7 +12,7 @@ struct Args { fn main() -> Result<()> { let args = Args::parse(); - minedmap::io::region::from_file(args.file.as_path())?.foreach_chunk( + minedmap_core::io::region::from_file(args.file.as_path())?.foreach_chunk( |coords, value: fastnbt::Value| { println!("Chunk {:?}: {:#x?}", coords, value); Ok(())