bracket_algorithm_traits/lib.rs
1#![warn(clippy::all, clippy::pedantic, clippy::cargo)]
2//! This crate is part of the `bracket-lib` family.
3//!
4//! It provides traits for you to implement on your map (and other geometric constructs),
5//! translating them into a format that works with the `bracket-pathfinding` and `bracket-geometry`
6//! systems.
7//!
8//! It is a separate crate so that both can depend upon it.
9//!
10//! Defaults are provided to get you up and running quickly, but may (should!) be overridden if you
11//! don't want to use my default array striding.
12//!
13//! For example:
14//! ```rust
15//! use bracket_algorithm_traits::prelude::{BaseMap, Algorithm2D};
16//! use bracket_geometry::prelude::Point;
17//!
18//! struct TestMap{};
19//! impl BaseMap for TestMap {}
20//! impl Algorithm2D for TestMap{
21//! fn dimensions(&self) -> Point {
22//! Point::new(2, 2)
23//! }
24//! }
25//! ```
26
27mod algorithm2d;
28mod algorithm3d;
29mod basemap;
30
31/// Exported traits
32pub mod prelude {
33 /// `Algorithm2D` support
34 pub use crate::algorithm2d::Algorithm2D;
35
36 /// `Algorithm3D` support
37 pub use crate::algorithm3d::Algorithm3D;
38
39 /// `BaseMap` support
40 pub use crate::basemap::BaseMap;
41
42 /// Since we use `SmallVec`, it's only polite to export it so you don't have to have multiple copies.
43 pub use smallvec::{smallvec, SmallVec};
44}