pub struct Module {
pub doc: String,
pub class: BTreeMap<TypeId, ClassDef>,
pub enum_: BTreeMap<TypeId, EnumDef>,
pub function: BTreeMap<&'static str, Vec<FunctionDef>>,
pub variables: BTreeMap<&'static str, VariableDef>,
pub type_aliases: BTreeMap<&'static str, TypeAliasDef>,
pub name: String,
pub default_module_name: String,
pub submodules: BTreeSet<String>,
pub module_re_exports: Vec<ModuleReExport>,
pub verbatim_all_entries: BTreeSet<String>,
pub excluded_all_entries: BTreeSet<String>,
}Expand description
Type info for a Python (sub-)module. This corresponds to a single *.pyi file.
Fields§
§doc: String§class: BTreeMap<TypeId, ClassDef>§enum_: BTreeMap<TypeId, EnumDef>§function: BTreeMap<&'static str, Vec<FunctionDef>>§variables: BTreeMap<&'static str, VariableDef>§type_aliases: BTreeMap<&'static str, TypeAliasDef>§name: String§default_module_name: String§submodules: BTreeSet<String>Direct submodules of this module.
module_re_exports: Vec<ModuleReExport>Module re-exports for all
verbatim_all_entries: BTreeSet<String>Verbatim entries to add to all
excluded_all_entries: BTreeSet<String>Explicitly excluded entries from all
Implementations§
Source§impl Module
impl Module
Sourcepub fn is_empty(&self) -> bool
pub fn is_empty(&self) -> bool
Check if this module has no content to generate.
Returns true if the module has no classes, enums, functions, variables, type aliases, submodules, re-exports, docstrings, or verbatim entries. Modules that are empty should be skipped during generation.
Sourcepub fn is_init_py_compatible(&self) -> bool
pub fn is_init_py_compatible(&self) -> bool
Check if this module can have __init__.py generated.
Returns true if the module has no PyO3-generated items (classes, enums,
functions, variables, type aliases). Such modules can only contain
re-exports and docstrings, which can be represented in __init__.py.
Sourcepub fn declared_item_names(&self) -> Vec<String>
pub fn declared_item_names(&self) -> Vec<String>
Get the names of all declared items in this module.
Returns a list of item names that were declared via gen_stub_* macros.
Sourcepub fn format_with_config(&self, use_type_statement: bool) -> String
pub fn format_with_config(&self, use_type_statement: bool) -> String
Format module with configuration for type alias syntax, returning a String
Sourcefn collect_all_items(&self) -> BTreeSet<String>
fn collect_all_items(&self) -> BTreeSet<String>
Collect all items for the __all__ list in .pyi stub files.
This collects public items from classes, enums, functions, variables,
type aliases, submodules, re-exports, and verbatim entries.
Items starting with _ are excluded unless added via export_verbatim!.
Sourcepub fn format_init_py(&self) -> String
pub fn format_init_py(&self) -> String
Format module as __init__.py content.
This generates a Python __init__.py file with re-exports and __all__ list.
Unlike format_with_config() which generates .pyi stub files, this generates
actual Python code for runtime use.
fn write_all_list(&self, f: &mut Formatter<'_>) -> Result
Trait Implementations§
impl StructuralPartialEq for Module
Auto Trait Implementations§
impl Freeze for Module
impl RefUnwindSafe for Module
impl Send for Module
impl Sync for Module
impl Unpin for Module
impl UnwindSafe for Module
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more