pub struct PythonResourcesState<'a, X>where
    [X]: ToOwned<Owned = Vec<X, Global>>,
{ /* private fields */ }
Expand description

Defines Python resources available for import.

Implementations§

Construct an instance from environment state.

Obtain the path of the current executable.

Set the path of the current executable.

Obtain the source path that relative paths are relative to.

Set the source path that relative paths are relative to.

Load resources by parsing a blob.

If an existing entry exists, the new entry will be merged into it. Set fields on the incoming entry will overwrite fields on the existing entry.

If an entry doesn’t exist, the resource will be inserted as-is.

Load resources data from a filesystem path using memory mapped I/O.

Load resources from packed data stored in a PyObject.

The PyObject must conform to the buffer protocol.

Load builtin modules from the Python interpreter.

Load frozen modules from the Python interpreter.

Load resources that are built-in to the Python interpreter.

If this instance’s resources are being used by the sole Python importer, this needs to be called to ensure modules required during interpreter initialization are indexed and loadable by our importer.

Says whether a named resource exists.

Add a resource to the instance.

Memory in the resource must live for at least as long as the lifetime of the resources this instance was created with.

Attempt to resolve an importable Python module.

Obtain a single named resource in a package.

Err occurs if loading the resource data fails. Ok(None) is returned if the resource does not exist. Otherwise the returned PyObject is a file-like object to read the resource data.

Determines whether a specific package + name pair is a known Python package resource.

Obtain the resources available in a Python package, as a Python list.

The names are returned in sorted order.

Whether the given resource name is a directory with resources.

Resolve package resources in a directory.

Attempt to resolve a PyBytes for resource data given a relative path.

Raises OSerror on failure.

This method is meant to be an implementation of ResourceLoader.get_data() and should only be used for that purpose.

Obtain a PyList of pkgutil.ModuleInfo for known resources.

This is intended to be used as the implementation for Finder.iter_modules().

package_filter defines the target package to return results for. The empty string denotes top-level packages only.

Resolve the names of package distributions matching a name filter.

Resolve data belonging to a package distribution resource.

Whether a package distribution resource name is a directory.

Obtain contents in a package distribution resources “directory.”

Resolve content of a shared library to load from memory.

Convert indexed resources to a PyList.

Serialize resources contained in this data structure.

ignore_built and ignore_frozen specify whether to ignore built-in extension modules and frozen modules, respectively.

Trait Implementations§

Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more
The type returned in the event of a conversion error.
Performs the conversion.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.