pub struct Package {Show 40 fields
pub name: String,
pub version: Option<Version>,
pub description: Option<String>,
pub authors: Vec<String>,
pub requires: Vec<String>,
pub build_requires: Vec<String>,
pub private_build_requires: Vec<String>,
pub variants: Vec<Vec<String>>,
pub tools: Vec<String>,
pub commands: Option<String>,
pub commands_function: Option<String>,
pub build_command: Option<String>,
pub build_system: Option<String>,
pub pre_commands: Option<String>,
pub post_commands: Option<String>,
pub pre_test_commands: Option<String>,
pub pre_build_commands: Option<String>,
pub tests: HashMap<String, String>,
pub requires_rez_version: Option<String>,
pub uuid: Option<String>,
pub config: HashMap<String, String>,
pub help: Option<String>,
pub relocatable: Option<bool>,
pub cachable: Option<bool>,
pub timestamp: Option<i64>,
pub revision: Option<String>,
pub changelog: Option<String>,
pub release_message: Option<String>,
pub previous_version: Option<Version>,
pub previous_revision: Option<String>,
pub vcs: Option<String>,
pub format_version: Option<i32>,
pub base: Option<String>,
pub has_plugins: Option<bool>,
pub plugin_for: Vec<String>,
pub hashed_variants: Option<bool>,
pub preprocess: Option<String>,
pub is_dev_package: Option<bool>,
pub filepath: Option<String>,
pub includes: Option<HashSet<String>>,
}Expand description
High-performance package representation compatible with rez
Fields§
§name: StringPackage name
version: Option<Version>Package version
description: Option<String>Package description
Package authors
requires: Vec<String>Package requirements
build_requires: Vec<String>Build requirements
private_build_requires: Vec<String>Private build requirements
variants: Vec<Vec<String>>Package variants
tools: Vec<String>Package tools
commands: Option<String>Package commands (rex script string, set from def commands(): body)
commands_function: Option<String>Package commands function body (alias for commands; used by validation layer)
build_command: Option<String>Build command for custom builds
build_system: Option<String>Build system type
pre_commands: Option<String>Pre commands (executed before main commands)
post_commands: Option<String>Post commands (executed after main commands)
pre_test_commands: Option<String>Pre test commands (executed before tests)
pre_build_commands: Option<String>Pre build commands (executed before build)
tests: HashMap<String, String>Package tests
requires_rez_version: Option<String>Required rez version
uuid: Option<String>Package UUID
config: HashMap<String, String>Package config
help: Option<String>Package help
relocatable: Option<bool>Package relocatable flag
cachable: Option<bool>Package cachable flag
timestamp: Option<i64>Package timestamp
revision: Option<String>Package revision
changelog: Option<String>Package changelog
release_message: Option<String>Package release message
previous_version: Option<Version>Previous version
previous_revision: Option<String>Previous revision
vcs: Option<String>VCS type
format_version: Option<i32>Package format version
base: Option<String>Package base
has_plugins: Option<bool>Package has plugins
plugin_for: Vec<String>Plugin for packages
hashed_variants: Option<bool>Package hashed variants
preprocess: Option<String>Package preprocess function
is_dev_package: Option<bool>Whether this is a developer package (loaded from a working directory)
filepath: Option<String>File path to the package definition file (package.py or package.yaml)
includes: Option<HashSet<String>>Set of included Python modules (from @include decorators)
Implementations§
Source§impl Package
impl Package
pub fn new(name: String) -> Self
Sourcepub fn qualified_name(&self) -> String
pub fn qualified_name(&self) -> String
Get the qualified name of the package (name-version)
Sourcepub fn as_exact_requirement(&self) -> String
pub fn as_exact_requirement(&self) -> String
Get the package as an exact requirement string
Sourcepub fn is_package(&self) -> bool
pub fn is_package(&self) -> bool
Check if this is a package (always true for Package)
Sourcepub fn is_variant(&self) -> bool
pub fn is_variant(&self) -> bool
Check if this is a variant (always false for Package)
Sourcepub fn num_variants(&self) -> usize
pub fn num_variants(&self) -> usize
Get the number of variants
Sourcepub fn set_version(&mut self, version: Version)
pub fn set_version(&mut self, version: Version)
Set the package version
Sourcepub fn set_description(&mut self, description: String)
pub fn set_description(&mut self, description: String)
Set the package description
Add an author
Sourcepub fn add_requirement(&mut self, requirement: String)
pub fn add_requirement(&mut self, requirement: String)
Add a requirement
Sourcepub fn add_build_requirement(&mut self, requirement: String)
pub fn add_build_requirement(&mut self, requirement: String)
Add a build requirement
Sourcepub fn add_private_build_requirement(&mut self, requirement: String)
pub fn add_private_build_requirement(&mut self, requirement: String)
Add a private build requirement
Sourcepub fn add_variant(&mut self, variant: Vec<String>)
pub fn add_variant(&mut self, variant: Vec<String>)
Add a variant
Sourcepub fn set_commands(&mut self, commands: String)
pub fn set_commands(&mut self, commands: String)
Set commands
Sourcepub fn validate(&self) -> Result<(), RezCoreError>
pub fn validate(&self) -> Result<(), RezCoreError>
Validate the package definition
Sourcepub fn from_path<P: AsRef<Path>>(path: P) -> Result<Self, RezCoreError>
pub fn from_path<P: AsRef<Path>>(path: P) -> Result<Self, RezCoreError>
Load a developer package from a path.
This aligns with Rez’s DeveloperPackage.from_path() interface.
Supports both file path (package.py/package.yaml) and directory path.
§Arguments
path- Directory containing package definition, or path to the file itself
§Returns
Result<Package, RezCoreError>- The loaded package
§Example
let pkg = Package::from_path(pkg_path).unwrap();
assert_eq!(pkg.name, "mypackage");Sourcepub fn root(&self) -> Option<String>
pub fn root(&self) -> Option<String>
Get the root directory of the package (parent of filepath).
Aligns with Rez’s DeveloperPackage.root property.
Sourcepub fn to_package_py(&self) -> String
pub fn to_package_py(&self) -> String
Serialize the package to package.py format string. Compatible with rez package.py format.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Package
impl<'de> Deserialize<'de> for Package
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for Package
impl RefUnwindSafe for Package
impl Send for Package
impl Sync for Package
impl Unpin for Package
impl UnsafeUnpin for Package
impl UnwindSafe for Package
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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