pyo3_introspection/
model.rs

1#[derive(Debug, Eq, PartialEq, Clone, Hash)]
2pub struct Module {
3    pub name: String,
4    pub modules: Vec<Module>,
5    pub classes: Vec<Class>,
6    pub functions: Vec<Function>,
7}
8
9#[derive(Debug, Eq, PartialEq, Clone, Hash)]
10pub struct Class {
11    pub name: String,
12    pub methods: Vec<Function>,
13}
14
15#[derive(Debug, Eq, PartialEq, Clone, Hash)]
16pub struct Function {
17    pub name: String,
18    /// decorator like 'property' or 'staticmethod'
19    pub decorators: Vec<String>,
20    pub arguments: Arguments,
21}
22
23#[derive(Debug, Eq, PartialEq, Clone, Hash)]
24pub struct Arguments {
25    /// Arguments before /
26    pub positional_only_arguments: Vec<Argument>,
27    /// Regular arguments (between / and *)
28    pub arguments: Vec<Argument>,
29    /// *vararg
30    pub vararg: Option<VariableLengthArgument>,
31    /// Arguments after *
32    pub keyword_only_arguments: Vec<Argument>,
33    /// **kwarg
34    pub kwarg: Option<VariableLengthArgument>,
35}
36
37#[derive(Debug, Eq, PartialEq, Clone, Hash)]
38pub struct Argument {
39    pub name: String,
40    /// Default value as a Python expression
41    pub default_value: Option<String>,
42}
43
44/// A variable length argument ie. *vararg or **kwarg
45#[derive(Debug, Eq, PartialEq, Clone, Hash)]
46pub struct VariableLengthArgument {
47    pub name: String,
48}