export all py types
This commit is contained in:
+3
-3
@@ -11,9 +11,9 @@ use crate::{
|
|||||||
map_attrs::PyBeatmapAttributes, perf_attrs::PyPerformanceAttributes, strains::PyStrains,
|
map_attrs::PyBeatmapAttributes, perf_attrs::PyPerformanceAttributes, strains::PyStrains,
|
||||||
};
|
};
|
||||||
|
|
||||||
#[pyclass]
|
#[pyclass(name = "Calculator")]
|
||||||
#[derive(Default)]
|
#[derive(Default)]
|
||||||
pub struct Calculator {
|
pub struct PyCalculator {
|
||||||
attributes: Option<DifficultyAttributes>,
|
attributes: Option<DifficultyAttributes>,
|
||||||
mode: Option<GameMode>,
|
mode: Option<GameMode>,
|
||||||
mods: Option<u32>,
|
mods: Option<u32>,
|
||||||
@@ -40,7 +40,7 @@ macro_rules! set_calc {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[pymethods]
|
#[pymethods]
|
||||||
impl Calculator {
|
impl PyCalculator {
|
||||||
#[new]
|
#[new]
|
||||||
#[args(kwargs = "**")]
|
#[args(kwargs = "**")]
|
||||||
fn new(kwargs: Option<&PyDict>) -> PyResult<Self> {
|
fn new(kwargs: Option<&PyDict>) -> PyResult<Self> {
|
||||||
|
|||||||
+18
-5
@@ -1,7 +1,14 @@
|
|||||||
#![deny(clippy::all, nonstandard_style, rust_2018_idioms, unused, warnings)]
|
#![deny(clippy::all, nonstandard_style, rust_2018_idioms, unused, warnings)]
|
||||||
|
|
||||||
use beatmap::PyBeatmap as Beatmap;
|
use self::{
|
||||||
use calculator::Calculator;
|
beatmap::PyBeatmap,
|
||||||
|
calculator::PyCalculator,
|
||||||
|
diff_attrs::PyDifficultyAttributes,
|
||||||
|
error::{KwargsError, ParseError},
|
||||||
|
map_attrs::PyBeatmapAttributes,
|
||||||
|
perf_attrs::PyPerformanceAttributes,
|
||||||
|
};
|
||||||
|
|
||||||
use pyo3::{pymodule, types::PyModule, PyResult, Python};
|
use pyo3::{pymodule, types::PyModule, PyResult, Python};
|
||||||
|
|
||||||
mod beatmap;
|
mod beatmap;
|
||||||
@@ -13,9 +20,15 @@ mod perf_attrs;
|
|||||||
mod strains;
|
mod strains;
|
||||||
|
|
||||||
#[pymodule]
|
#[pymodule]
|
||||||
fn rosu_pp_py(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
|
fn rosu_pp_py(py: Python<'_>, m: &PyModule) -> PyResult<()> {
|
||||||
m.add_class::<Beatmap>()?;
|
m.add_class::<PyBeatmap>()?;
|
||||||
m.add_class::<Calculator>()?;
|
m.add_class::<PyCalculator>()?;
|
||||||
|
m.add_class::<PyBeatmapAttributes>()?;
|
||||||
|
m.add_class::<PyDifficultyAttributes>()?;
|
||||||
|
m.add_class::<PyPerformanceAttributes>()?;
|
||||||
|
|
||||||
|
m.add("ParseError", py.get_type::<ParseError>())?;
|
||||||
|
m.add("KwargsError", py.get_type::<KwargsError>())?;
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user