Struct PythonExtensionModule

Source
pub struct PythonExtensionModule {
    pub name: String,
    pub init_fn: Option<String>,
    pub extension_file_suffix: String,
    pub shared_library: Option<FileData>,
    pub object_file_data: Vec<FileData>,
    pub is_package: bool,
    pub link_libraries: Vec<LibraryDependency>,
    pub is_stdlib: bool,
    pub builtin_default: bool,
    pub required: bool,
    pub variant: Option<String>,
    pub license: Option<LicensedComponent>,
}
Expand description

Represents a Python extension module.

Fields§

§name: String

The module name this extension module is providing.

§init_fn: Option<String>

Name of the C function initializing this extension module.

§extension_file_suffix: String

Filename suffix to use when writing extension module data.

§shared_library: Option<FileData>

File data for linked extension module.

§object_file_data: Vec<FileData>

File data for object files linked together to produce this extension module.

§is_package: bool

Whether this extension module is a package.

§link_libraries: Vec<LibraryDependency>

Libraries that this extension depends on.

§is_stdlib: bool

Whether this extension module is part of the Python standard library.

This is true if the extension is distributed with Python itself.

§builtin_default: bool

Whether the extension module is built-in by default.

Some extension modules in Python distributions are always compiled into libpython. This field will be true for those extension modules.

§required: bool

Whether the extension must be loaded to initialize Python.

§variant: Option<String>

Name of the variant of this extension module.

This may be set if there are multiple versions of an extension module available to choose from.

§license: Option<LicensedComponent>

Licenses that apply to this extension.

Implementations§

Source§

impl PythonExtensionModule

Source

pub fn description(&self) -> String

Source

pub fn to_memory(&self) -> Result<Self>

Source

pub fn file_name(&self) -> String

The file name (without parent components) this extension module should be realized with.

Source

pub fn resolve_path(&self, prefix: &str) -> PathBuf

Resolve the filesystem path for this extension module.

Source

pub fn package_parts(&self) -> Vec<String>

Returns the part strings constituting the package name.

Source

pub fn requires_libraries(&self) -> bool

Whether the extension module requires additional libraries.

Source

pub fn is_minimally_required(&self) -> bool

Whether the extension module is minimally required for a Python interpreter.

This will be true only for extension modules in the standard library that are builtins part of libpython or are required as part of Python interpreter initialization.

Source

pub fn in_libpython(&self) -> bool

Whether this extension module is already in libpython.

This is true if this is a stdlib extension module and is a core module or no shared library extension module is available.

Source

pub fn top_level_package(&self) -> &str

Obtain the top-level package name this module belongs to.

Trait Implementations§

Source§

impl Clone for PythonExtensionModule

Source§

fn clone(&self) -> PythonExtensionModule

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for PythonExtensionModule

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'a> From<&'a PythonExtensionModule> for PythonResource<'a>

Source§

fn from(r: &'a PythonExtensionModule) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<PythonExtensionModule> for PythonResource<'a>

Source§

fn from(r: PythonExtensionModule) -> Self

Converts to this type from the input type.
Source§

impl FromIterator<PythonExtensionModule> for PythonExtensionModuleVariants

Source§

fn from_iter<I: IntoIterator<Item = PythonExtensionModule>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl PartialEq for PythonExtensionModule

Source§

fn eq(&self, other: &PythonExtensionModule) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for PythonExtensionModule

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.