export all py types

This commit is contained in:
Max
2022-10-29 20:01:56 +02:00
parent fe7fa084ba
commit 1cba96f309
2 changed files with 21 additions and 8 deletions
+3 -3
View File
@@ -11,9 +11,9 @@ use crate::{
map_attrs::PyBeatmapAttributes, perf_attrs::PyPerformanceAttributes, strains::PyStrains,
};
#[pyclass]
#[pyclass(name = "Calculator")]
#[derive(Default)]
pub struct Calculator {
pub struct PyCalculator {
attributes: Option<DifficultyAttributes>,
mode: Option<GameMode>,
mods: Option<u32>,
@@ -40,7 +40,7 @@ macro_rules! set_calc {
}
#[pymethods]
impl Calculator {
impl PyCalculator {
#[new]
#[args(kwargs = "**")]
fn new(kwargs: Option<&PyDict>) -> PyResult<Self> {
+18 -5
View File
@@ -1,7 +1,14 @@
#![deny(clippy::all, nonstandard_style, rust_2018_idioms, unused, warnings)]
use beatmap::PyBeatmap as Beatmap;
use calculator::Calculator;
use self::{
beatmap::PyBeatmap,
calculator::PyCalculator,
diff_attrs::PyDifficultyAttributes,
error::{KwargsError, ParseError},
map_attrs::PyBeatmapAttributes,
perf_attrs::PyPerformanceAttributes,
};
use pyo3::{pymodule, types::PyModule, PyResult, Python};
mod beatmap;
@@ -13,9 +20,15 @@ mod perf_attrs;
mod strains;
#[pymodule]
fn rosu_pp_py(_py: Python<'_>, m: &PyModule) -> PyResult<()> {
m.add_class::<Beatmap>()?;
m.add_class::<Calculator>()?;
fn rosu_pp_py(py: Python<'_>, m: &PyModule) -> PyResult<()> {
m.add_class::<PyBeatmap>()?;
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(())
}