I want to document the functions of my python library. I coded it using Rust and the cpython crate. An example of a function follows:
Rust function signature: async fn get_problem(num: u16) -> Result<Problem, ExitFailure> { ... }
Rust function wrapper to be able to add function to python module:
fn get_problem_py(_: Python<'_>, num: u16) -> PyResult<Problem> {
let rt = tokio::runtime::Runtime::new().unwrap();
let contents = rt.block_on(get_problem(num)).unwrap();
Ok(contents)
}
py_module_initializer macro:
py_module_initializer!(u_interface, |py, m| {
...
m.add(py, "get_problem", py_fn!(py, get_problem_py(num: u16)))?;
...
Ok(())
});
How can I document this function? Say for example I want the documentation to be "do something"