[][src]Struct python_packed_resources::data::Resource

pub struct Resource<'a, X: 'a> where
    [X]: ToOwned<Owned = Vec<X>>, 
{ pub flavor: ResourceFlavor, pub name: Cow<'a, str>, pub is_package: bool, pub is_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>>>, }

Represents an embedded resource and all its metadata.

Fields

flavor: ResourceFlavor

The flavor of the resource.

name: Cow<'a, str>

The resource name.

is_package: bool

Whether the Python module is a package.

is_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.

Methods

impl<'a, X: Clone + 'a> Resource<'a, X> where
    [X]: ToOwned<Owned = Vec<X>>, 
[src]

pub fn is_meaningful(&self) -> bool[src]

Whether the module is meaningful.

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

pub fn index_v1_length(&self) -> usize[src]

Compute length of index entry for version 1 payload format.

pub fn field_blob_length(&self, field: ResourceField) -> usize[src]

Compute the length of a field.

Interior padding is not part of the returned length.

pub fn field_blob_interior_padding_length(
    &self,
    field: ResourceField,
    padding: BlobInteriorPadding
) -> usize
[src]

Compute the size of interior padding for a specific field.

pub fn write_index_v1<W: Write>(&self, dest: &mut W) -> Result<()>[src]

Write the version 1 index entry for a module instance.

Trait Implementations

impl<'a, X: Clone + 'a> Clone for Resource<'a, X> where
    [X]: ToOwned<Owned = Vec<X>>, 
[src]

impl<'a, X: Debug + 'a> Debug for Resource<'a, X> where
    [X]: ToOwned<Owned = Vec<X>>, 
[src]

impl<'a, X> Default for Resource<'a, X> where
    [X]: ToOwned<Owned = Vec<X>>, 
[src]

impl<'a, X: PartialEq + 'a> PartialEq<Resource<'a, X>> for Resource<'a, X> where
    [X]: ToOwned<Owned = Vec<X>>, 
[src]

impl<'a, X: 'a> StructuralPartialEq for Resource<'a, X> where
    [X]: ToOwned<Owned = Vec<X>>, 
[src]

Auto Trait Implementations

impl<'a, X> RefUnwindSafe for Resource<'a, X> where
    X: RefUnwindSafe

impl<'a, X> Send for Resource<'a, X> where
    X: Send + Sync

impl<'a, X> Sync for Resource<'a, X> where
    X: Sync

impl<'a, X> Unpin for Resource<'a, X> where
    X: Unpin

impl<'a, X> UnwindSafe for Resource<'a, X> where
    X: RefUnwindSafe + UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.