1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#![warn(missing_docs)]

//! A library for 2D & 3D procedural generation with Model synthesis/Wave function Collapse.
//! Also provide grid utilities to manipulate 23&3d grid data.

/// Model synthesis/Wave function Collapse generator
pub mod generator;
/// Grid utilities
pub mod grid;

/// Error returned by a [`generator::Generator`] when a generation fails
#[derive(thiserror::Error, Debug)]
#[error("Failed to generate, contradiction at node with index {}", node_index)]
pub struct GenerationError {
    /// Node index at which the contradiction occurred
    pub node_index: usize,
}

/// Error returned by a [`generator::rules::RulesBuilder`] when correct [`generator::rules::Rules`] cannot be built
#[derive(thiserror::Error, Debug)]
pub enum RulesError {
    /// Rules cannot be built without models or sockets
    #[error("Empty models or sockets collection")]
    NoModelsOrSockets,
}