refactor(shared): migrate mod.rs modules to path-style files

This commit is contained in:
Serkyo 2026-07-09 19:47:00 +02:00
parent 1db124e63b
commit b6687dc82b
2 changed files with 34 additions and 0 deletions

12
crates/shared/src/save.rs Normal file
View file

@ -0,0 +1,12 @@
// SPDX-License-Identifier: AGPL-3.0-only
//! On-disk save format: the framing that persists modified chunks to region files.
//!
//! The format is built bottom-up. The smallest unit is the `SYNC` per-chunk [`record`], which wraps one [`crate::world::ChunkData`] in a self-describing, compressed frame. Region-level framing (the `SYNR` file and its header table) is layered on top of it. All parsing treats on-disk bytes as untrusted and reports failures through [`SaveError`].
mod cursor;
mod error;
pub mod record;
pub mod region;
pub use error::SaveError;

View file

@ -0,0 +1,22 @@
// SPDX-License-Identifier: AGPL-3.0-only
//! Core data structures representing the voxel world.
//!
//! The module is split by concept: [`BlockId`] material handles, the [`Chunk`] storage forms, chunk-space coordinates in [`ChunkPos`], and precision-safe entity positions in [`EntityPos`]. Each lives in its own submodule and is re-exported here so callers continue to refer to `shared::world::<Type>` regardless of the internal layout.
mod block;
mod chunk;
mod chunk_data;
mod coords;
mod entity;
pub use block::BlockId;
pub use chunk::{Chunk, PalettedChunk};
pub use chunk_data::ChunkData;
pub use coords::ChunkPos;
pub use entity::EntityPos;
/// The size of a chunk along one axis in blocks.
pub const CHUNK_SIZE: usize = 32;
/// The total number of blocks within a single chunk.
pub const CHUNK_VOLUME: usize = CHUNK_SIZE * CHUNK_SIZE * CHUNK_SIZE;