Struct python_packaging::resource_collection::PrePackagedResource[][src]

pub struct PrePackagedResource {
Show fields pub name: String, pub is_package: bool, pub is_namespace_package: bool, pub in_memory_source: Option<FileData>, pub in_memory_bytecode: Option<PythonModuleBytecodeProvider>, pub in_memory_bytecode_opt1: Option<PythonModuleBytecodeProvider>, pub in_memory_bytecode_opt2: Option<PythonModuleBytecodeProvider>, pub in_memory_extension_module_shared_library: Option<FileData>, pub in_memory_resources: Option<BTreeMap<String, FileData>>, pub in_memory_distribution_resources: Option<BTreeMap<String, FileData>>, pub in_memory_shared_library: Option<FileData>, pub shared_library_dependency_names: Option<Vec<String>>, pub relative_path_module_source: Option<(String, FileData)>, pub relative_path_bytecode: Option<(String, String, PythonModuleBytecodeProvider)>, pub relative_path_bytecode_opt1: Option<(String, String, PythonModuleBytecodeProvider)>, pub relative_path_bytecode_opt2: Option<(String, String, PythonModuleBytecodeProvider)>, pub relative_path_extension_module_shared_library: Option<(PathBuf, FileData)>, pub relative_path_package_resources: Option<BTreeMap<String, (PathBuf, FileData)>>, pub relative_path_distribution_resources: Option<BTreeMap<String, (PathBuf, FileData)>>, pub relative_path_shared_library: Option<(String, PathBuf, FileData)>, pub is_module: bool, pub is_builtin_extension_module: bool, pub is_frozen_module: bool, pub is_extension_module: bool, pub is_shared_library: bool, pub is_utf8_filename_data: bool, pub file_executable: bool, pub file_data_embedded: Option<FileData>, pub file_data_utf8_relative_path: Option<(PathBuf, FileData)>,
}

Represents a Python resource entry before it is packaged.

Instances hold the same fields as Resource except fields holding content are backed by a FileData instead of Vec<u8>, since we want data resolution to be lazy. In addition, bytecode can either be provided verbatim or via source.

Fields

name: Stringis_package: boolis_namespace_package: boolin_memory_source: Option<FileData>in_memory_bytecode: Option<PythonModuleBytecodeProvider>in_memory_bytecode_opt1: Option<PythonModuleBytecodeProvider>in_memory_bytecode_opt2: Option<PythonModuleBytecodeProvider>in_memory_extension_module_shared_library: Option<FileData>in_memory_resources: Option<BTreeMap<String, FileData>>in_memory_distribution_resources: Option<BTreeMap<String, FileData>>in_memory_shared_library: Option<FileData>shared_library_dependency_names: Option<Vec<String>>relative_path_module_source: Option<(String, FileData)>relative_path_bytecode: Option<(String, String, PythonModuleBytecodeProvider)>relative_path_bytecode_opt1: Option<(String, String, PythonModuleBytecodeProvider)>relative_path_bytecode_opt2: Option<(String, String, PythonModuleBytecodeProvider)>relative_path_extension_module_shared_library: Option<(PathBuf, FileData)>relative_path_package_resources: Option<BTreeMap<String, (PathBuf, FileData)>>relative_path_distribution_resources: Option<BTreeMap<String, (PathBuf, FileData)>>relative_path_shared_library: Option<(String, PathBuf, FileData)>is_module: boolis_builtin_extension_module: boolis_frozen_module: boolis_extension_module: boolis_shared_library: boolis_utf8_filename_data: boolfile_executable: boolfile_data_embedded: Option<FileData>file_data_utf8_relative_path: Option<(PathBuf, FileData)>

Implementations

impl PrePackagedResource[src]

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

Whether this resource represents a Python resource.

pub fn to_resource<'a>(
    &self,
    compiler: &mut dyn PythonBytecodeCompiler
) -> Result<(Resource<'a, u8>, Vec<FileInstall>)>
[src]

Convert the instance to a Resource.

This will compile bytecode from source code using the specified compiler. It will also emit a list of file installs that must be performed for all referenced resources to function as intended.

Trait Implementations

impl Clone for PrePackagedResource[src]

fn clone(&self) -> PrePackagedResource[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl Debug for PrePackagedResource[src]

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

Formats the value using the given formatter. Read more

impl Default for PrePackagedResource[src]

fn default() -> PrePackagedResource[src]

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

impl PartialEq<PrePackagedResource> for PrePackagedResource[src]

fn eq(&self, other: &PrePackagedResource) -> bool[src]

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

fn ne(&self, other: &PrePackagedResource) -> bool[src]

This method tests for !=.

impl StructuralPartialEq for PrePackagedResource[src]

Auto Trait Implementations

Blanket Implementations

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

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

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

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

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

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

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

pub fn from(t: T) -> T[src]

Performs the conversion.

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

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> Same<T> for T

type Output = T

Should always be Self

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

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

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

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

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

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.

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

Performs the conversion.

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.

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

Performs the conversion.