pub struct StubInfo {
pub modules: BTreeMap<String, Module>,
pub python_root: PathBuf,
pub is_mixed_layout: bool,
pub config: StubGenConfig,
pub pyproject_dir: Option<PathBuf>,
pub default_module_name: String,
pub project_name: String,
}Fields§
§modules: BTreeMap<String, Module>§python_root: PathBuf§is_mixed_layout: boolWhether this is a mixed Python/Rust layout (has python-source in pyproject.toml)
config: StubGenConfigConfiguration options for stub generation
pyproject_dir: Option<PathBuf>Directory containing pyproject.toml (for relative path calculations)
default_module_name: StringThe default module name (from module-name in pyproject.toml or #[pymodule])
project_name: StringThe project name (from project.name in pyproject.toml)
Used for documentation generation as the package display name
Implementations§
Source§impl StubInfo
impl StubInfo
Sourcepub fn from_pyproject_toml(path: impl AsRef<Path>) -> Result<Self>
pub fn from_pyproject_toml(path: impl AsRef<Path>) -> Result<Self>
Initialize StubInfo from a pyproject.toml file in CARGO_MANIFEST_DIR.
This is automatically set up by the crate::define_stub_info_gatherer macro.
Sourcepub fn from_project_root(
default_module_name: String,
project_root: PathBuf,
is_mixed_layout: bool,
config: StubGenConfig,
) -> Result<Self>
pub fn from_project_root( default_module_name: String, project_root: PathBuf, is_mixed_layout: bool, config: StubGenConfig, ) -> Result<Self>
Initialize StubInfo with a specific module name, project root, and configuration.
This must be placed in your PyO3 library crate, i.e. the same crate where inventory::submitted,
not in the gen_stub executables due to inventory’s mechanism.
pub fn generate(&self) -> Result<()>
fn write_stub_file(&self, dest: &Path, module: &Module) -> Result<()>
Sourcefn is_pyo3_generated(&self, module: &str) -> bool
fn is_pyo3_generated(&self, module: &str) -> bool
Check if a module is part of the PyO3 shared library.
In mixed layout, modules at or below module-name are considered part of the
PyO3 shared library. Modules above module-name are Pure Python modules.
fn generate_docs(&self, config: &DocGenConfig) -> Result<()>
Trait Implementations§
impl StructuralPartialEq for StubInfo
Auto Trait Implementations§
impl Freeze for StubInfo
impl RefUnwindSafe for StubInfo
impl Send for StubInfo
impl Sync for StubInfo
impl Unpin for StubInfo
impl UnwindSafe for StubInfo
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