akinator/
lib.rs

1//! Python bindings for ``akinator-rs``, a wrapper around the undocumented akinator API
2//!
3//! designed for easy implementation of an akinator game in code, providing a simple and easy to use API.
4
5use crate::{
6    enums::{
7        Theme,
8        Answer,
9        Language,
10    },
11    async_akinator::AsyncAkinator,
12    blocking_akinator::Akinator,
13    models::Guess,
14};
15
16use pyo3::prelude::*;
17
18pub mod blocking_akinator;
19pub mod async_akinator;
20pub mod enums;
21pub mod error;
22pub mod models;
23
24
25/// Python bindings for ``akinator-rs``, a wrapper around the undocumented akinator API
26///
27/// designed for easy implementation of an akinator game in code, providing a simple and easy to use API.
28#[pymodule]
29fn akinator(py: Python<'_>, module: &PyModule) -> PyResult<()> {
30    module.add_class::<AsyncAkinator>()?;
31    module.add_class::<Akinator>()?;
32    module.add_class::<Guess>()?;
33
34    module.add_class::<Theme>()?;
35    module.add_class::<Answer>()?;
36    module.add_class::<Language>()?;
37
38    error::add_exceptions(py, module)?;
39
40    Ok(())
41}