diff options
| author | 2025-09-12 04:02:02 +0800 | |
|---|---|---|
| committer | 2025-09-12 04:02:02 +0800 | |
| commit | 0288d0956330d5ac8db48b752240f723e8703929 (patch) | |
| tree | 0297dee9f8166af0a856dd3a1057ad5f25f14c6a /src/lib.rs | |
| parent | 5135876b5e2a6c40232414ea0b7eb875fa225cf0 (diff) | |
| download | OneRoll-0288d0956330d5ac8db48b752240f723e8703929.tar.gz OneRoll-0288d0956330d5ac8db48b752240f723e8703929.zip | |
feat: initial basic roll features
Diffstat (limited to 'src/lib.rs')
| -rw-r--r-- | src/lib.rs | 26 |
1 files changed, 18 insertions, 8 deletions
@@ -1,16 +1,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::*; -#[pyfunction] -fn sum_as_string(a: usize, b: usize) -> PyResult<String> { - Ok((a + b).to_string()) -} +mod errors; +mod types; +mod calculator; +mod parser; +mod python_bindings; -#[pyclass] -pub struct Base {} +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!(sum_as_string, m)?)?; - m.add_class::<Base>()?; + m.add_function(wrap_pyfunction!(roll_dice, m)?)?; + m.add_function(wrap_pyfunction!(roll_simple, m)?)?; + m.add_class::<OneRoll>()?; Ok(()) }
\ No newline at end of file |
