pub struct Resource<'a, X: 'a> where
    [X]: ToOwned<Owned = Vec<X>>, 
{
Show 28 fields pub name: Cow<'a, str>, pub is_python_module: bool, pub is_python_builtin_extension_module: bool, pub is_python_frozen_module: bool, pub is_python_extension_module: bool, pub is_shared_library: bool, pub is_utf8_filename_data: bool, pub is_python_package: bool, pub is_python_namespace_package: bool, pub in_memory_source: Option<Cow<'a, [X]>>, pub in_memory_bytecode: Option<Cow<'a, [X]>>, pub in_memory_bytecode_opt1: Option<Cow<'a, [X]>>, pub in_memory_bytecode_opt2: Option<Cow<'a, [X]>>, pub in_memory_extension_module_shared_library: Option<Cow<'a, [X]>>, pub in_memory_package_resources: Option<HashMap<Cow<'a, str>, Cow<'a, [X]>>>, pub in_memory_distribution_resources: Option<HashMap<Cow<'a, str>, Cow<'a, [X]>>>, pub in_memory_shared_library: Option<Cow<'a, [X]>>, pub shared_library_dependency_names: Option<Vec<Cow<'a, str>>>, pub relative_path_module_source: Option<Cow<'a, Path>>, pub relative_path_module_bytecode: Option<Cow<'a, Path>>, pub relative_path_module_bytecode_opt1: Option<Cow<'a, Path>>, pub relative_path_module_bytecode_opt2: Option<Cow<'a, Path>>, pub relative_path_extension_module_shared_library: Option<Cow<'a, Path>>, pub relative_path_package_resources: Option<HashMap<Cow<'a, str>, Cow<'a, Path>>>, pub relative_path_distribution_resources: Option<HashMap<Cow<'a, str>, Cow<'a, Path>>>, pub file_executable: bool, pub file_data_embedded: Option<Cow<'a, [X]>>, pub file_data_utf8_relative_path: Option<Cow<'a, str>>,
}
Expand description

Represents an indexed resource.

The resource has a name and type affinity via various is_* fields.

The data for the resource may be present in the instance or referenced via an external filesystem path.

Data fields are Cow<T> and can either hold a borrowed reference or owned data. This allows the use of a single type to both hold data or reference it from some other location.

Fields

name: Cow<'a, str>

The resource name.

is_python_module: bool

Whether this resource defines a Python module/package.

is_python_builtin_extension_module: bool

Whether this resource defines a builtin extension module.

is_python_frozen_module: bool

Whether this resource defines a frozen Python module.

is_python_extension_module: bool

Whether this resource defines a Python extension module.

is_shared_library: bool

Whether this resource defines a shared library.

is_utf8_filename_data: bool

Whether this resource defines data for an arbitrary file.

If set, name is the UTF-8 encoded filename being represented.

The file data should exist in one of the file_data_* fields.

is_python_package: bool

Whether the Python module is a package.

is_python_namespace_package: bool

Whether the Python module is a namespace package.

in_memory_source: Option<Cow<'a, [X]>>

Python module source code to use to import module from memory.

in_memory_bytecode: Option<Cow<'a, [X]>>

Python module bytecode to use to import module from memory.

in_memory_bytecode_opt1: Option<Cow<'a, [X]>>

Python module bytecode at optimized level 1 to use to import from memory.

in_memory_bytecode_opt2: Option<Cow<'a, [X]>>

Python module bytecode at optimized level 2 to use to import from memory.

in_memory_extension_module_shared_library: Option<Cow<'a, [X]>>

Native machine code constituting a shared library for an extension module which can be imported from memory. (Not supported on all platforms.)

in_memory_package_resources: Option<HashMap<Cow<'a, str>, Cow<'a, [X]>>>

Mapping of virtual filename to data for resources to expose to Python’s importlib.resources API via in-memory data access.

in_memory_distribution_resources: Option<HashMap<Cow<'a, str>, Cow<'a, [X]>>>

Mapping of virtual filename to data for package distribution metadata to expose to Python’s importlib.metadata API via in-memory data access.

in_memory_shared_library: Option<Cow<'a, [X]>>

Native machine code constituting a shared library which can be imported from memory.

In-memory loading of shared libraries is not supported on all platforms.

shared_library_dependency_names: Option<Vec<Cow<'a, str>>>

Sequence of names of shared libraries this resource depends on.

relative_path_module_source: Option<Cow<'a, Path>>

Relative path to file containing Python module source code.

relative_path_module_bytecode: Option<Cow<'a, Path>>

Relative path to file containing Python module bytecode.

relative_path_module_bytecode_opt1: Option<Cow<'a, Path>>

Relative path to file containing Python module bytecode at optimization level 1.

relative_path_module_bytecode_opt2: Option<Cow<'a, Path>>

Relative path to file containing Python module bytecode at optimization level 2.

relative_path_extension_module_shared_library: Option<Cow<'a, Path>>

Relative path to file containing Python extension module loadable as a shared library.

relative_path_package_resources: Option<HashMap<Cow<'a, str>, Cow<'a, Path>>>

Mapping of Python package resource names to relative filesystem paths for those resources.

relative_path_distribution_resources: Option<HashMap<Cow<'a, str>, Cow<'a, Path>>>

Mapping of Python package distribution files to relative filesystem paths for those resources.

file_executable: bool

Whether this resource’s file data should be executable.

file_data_embedded: Option<Cow<'a, [X]>>

Holds arbitrary file data in memory.

file_data_utf8_relative_path: Option<Cow<'a, str>>

Holds arbitrary file data in a relative path encoded in UTF-8.

Implementations

Merge another resource into this one.

Fields from other will overwrite fields from self.

Whether the resource is meaningful.

The resource is meaningful if it has data attached or is a package.

Compute length of index entry for version 1 payload format.

Compute the length of a field.

Interior padding is not part of the returned length.

Compute the size of interior padding for a specific field.

Write the version 1 index entry for a resource instance.

Trait Implementations

Converts this type into a shared reference of the (usually inferred) input type.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

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 resulting type after obtaining ownership.

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

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

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.