summaryrefslogtreecommitdiffstatshomepage
path: root/src/lib.rs
blob: 68821bd1323132fda8bb5918b799a4501ec3276d (plain) (blame)
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
26
//! OneRoll - High-performance dice expression parser
//!
//! This is a dice expression parser implemented in Rust and bound to Python through PyO3.
//! Supports complex dice expression parsing, various modifiers and mathematical operations.

use pyo3::prelude::*;

mod errors;
mod types;
mod calculator;
mod parser;
mod python_bindings;

pub use errors::DiceError;
pub use types::{DiceResult, DiceRoll, DiceModifier, Expression};
pub use calculator::DiceCalculator;
pub use parser::DiceParser;
pub use python_bindings::{OneRoll, roll_dice, roll_simple};

#[pymodule]
fn _core(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
    m.add_function(wrap_pyfunction!(roll_dice, m)?)?;
    m.add_function(wrap_pyfunction!(roll_simple, m)?)?;
    m.add_class::<OneRoll>()?;
    Ok(())
}