Module type_info

Source
Expand description

Store of metadata for generating Python stub file

Stub file generation takes two steps:

§Store metadata (compile time)

Embed compile-time information about Rust types and PyO3 macro arguments using inventory::submit! macro into source codes, and these information will be gathered by inventory::iter. This submodule is responsible for this process.

  • PyClassInfo stores information obtained from #[pyclass] macro
  • PyMethodsInfo stores information obtained from #[pymethods] macro

and others are their components.

§Gathering metadata and generating stub file (runtime)

Since #[pyclass] and #[pymethods] definitions are not bundled in a single block, we have to reconstruct these information corresponding to a Python class. This process is done at runtime in gen_stub executable.

Structs§

ArgInfo
Info of method argument appears in #[pymethods]
DeprecatedInfo
Information about deprecated items
MemberInfo
Info of getter method decorated with #[getter] or #[pyo3(get, set)] appears in #[pyclass]
MethodInfo
Info of usual method appears in #[pymethod]
PyClassInfo
Info of #[pyclass] with Rust struct
PyComplexEnumInfo
Info of a #[pyclass] with a rich (structured) Rust enum
PyEnumInfo
Info of #[pyclass] with Rust enum
PyFunctionInfo
Info of #[pyfunction]
PyMethodsInfo
Info of #[pymethod]
PyVariableInfo
VariantInfo
Info of a #[pyclass] with a single variant of a rich (structured) Rust enum

Enums§

IgnoreTarget
Represents the target of type ignore comments
MethodType
Type of a method
SignatureArg
VariantForm

Functions§

compare_op_type_input
Work around for CompareOp for __richcmp__ argument, which does not implements FromPyObject
no_return_type_output