dnd/
lib.rs

1//! D&D 5e types and common mechanics.
2//!
3//! This crate provides types and common mechanics used in Dungeons & Dragons 5th Edition (D&D 5e).
4//!
5//! ## Getting Started
6//!
7//! To use this crate, add it to your `Cargo.toml` file:
8//!
9//! ```toml
10//! [dependencies.dnd]
11//! version = "0.1"
12//! ```
13//!
14//! You can then import the necessary modules in your Rust code:
15//!
16//! ```rust
17//! use dnd::core::{AbilityScore, AbilityModifier, Level, ProficiencyBonus};
18//!
19//! let strength = AbilityScore::new(16);
20//! let modifier = AbilityModifier::from(strength);
21//! let level = Level::new(5);
22//! let proficiency_bonus = ProficiencyBonus::from(level);
23//! assert_eq!(modifier.value(), 3);
24//! assert_eq!(proficiency_bonus.value(), 3);
25//! ```
26//!
27//! ## Features
28//!
29//! It is compatible with `no_std` environments, making it suitable for embedded systems:
30//!
31//! ```toml
32//! [dependencies.dnd]
33//! version = "0.1"
34//! default-features = false
35//! ```
36
37#![no_std]
38
39/// A dependency-free[^1] foundation of `dnd`.
40///
41/// [^1]: Optionally includes `serde` for serialization and deserialization features.
42pub mod core;