hexlab/lib.rs
1//! Hexlab is a library for generating and manipulating hexagonal mazes.
2//!
3//! # Features
4//!
5//! - Create hexagonal mazes of configurable size
6//! - Customizable maze properties (radius, start position, seed)
7//! - Efficient bit-flag representation of walls
8//! - Multiple maze generation algorithms
9//! - Maze builder pattern for easy maze creation
10//!
11//! # Examples
12//!
13//! Here's a quick example to create a simple hexagonal maze:
14//!
15//!```
16//! use hexlab::prelude::*;
17//!
18//! let maze = MazeBuilder::new()
19//! .with_radius(3)
20//! .build()
21//! .expect("Failed to create maze");
22//!
23//! assert_eq!(maze.len(), 37); // A radius of 3 should create 37 tiles
24//!```
25//!
26//! Customizing maze generation:
27//!
28//!```
29//! use hexlab::prelude::*;
30//!
31//! let maze = MazeBuilder::new()
32//! .with_radius(2)
33//! .with_seed(12345)
34//! .with_start_position(Hex::new(1, -1))
35//! .build()
36//! .expect("Failed to create maze");
37//!
38//! assert!(maze.get(&Hex::new(1, -1)).is_some());
39//!```
40//!
41//! Manipulating walls:
42//!
43//!```
44//! use hexlab::prelude::*;
45//!
46//! let mut walls = Walls::empty();
47//! assert!(!walls.insert(EdgeDirection::FLAT_NORTH));
48//! assert!(walls.contains(EdgeDirection::FLAT_NORTH));
49//! assert!(!walls.contains(EdgeDirection::FLAT_SOUTH));
50//!```
51mod builder;
52pub mod errors;
53mod generator;
54mod maze;
55#[cfg(feature = "pathfinding")]
56mod pathfinding;
57mod tile;
58pub mod traits;
59mod walls;
60
61pub use builder::MazeBuilder;
62pub use errors::*;
63pub use generator::GeneratorType;
64pub use maze::Maze;
65pub use tile::Tile;
66pub use traits::*;
67pub use walls::Walls;
68
69/// Prelude module containing commonly used types
70pub mod prelude {
71 pub use super::{errors::*, traits::*, GeneratorType, Maze, MazeBuilder, Tile, Walls};
72 pub use hexx::{EdgeDirection, Hex, HexLayout};
73}