From 7a1aa179087a274d6f6b13c2c666043ac9760ea5 Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Fri, 24 Oct 2025 10:24:45 +0200 Subject: modules: rust: implement workspace.package() Note that, as shown in the testcase, package() works in the subproject as well. This means that in the future the Cargo code generator can be changed to reduce the amount of generated code and instead rely on the package object. Signed-off-by: Paolo Bonzini --- docs/markdown/Rust-module.md | 29 +++++++++++++++++++++-------- 1 file changed, 21 insertions(+), 8 deletions(-) (limited to 'docs/markdown/Rust-module.md') diff --git a/docs/markdown/Rust-module.md b/docs/markdown/Rust-module.md index fbe65f1b6..ba500e7ee 100644 --- a/docs/markdown/Rust-module.md +++ b/docs/markdown/Rust-module.md @@ -241,6 +241,19 @@ packages = ws.packages() Returns a list of package names in the workspace. +### workspace.package() + +```meson +pkg = ws.package([package_name]) +``` + +Returns a package object for the given package member. If empty, returns +the object for the root package. + +Arguments: +- `package_name`: (str, optional) Name of the package; not needed for the + root package of a workspace + ### workspace.subproject() ```meson @@ -258,15 +271,15 @@ Positional arguments: The package object returned by `workspace.subproject()` provides methods for working with individual packages in a Cargo workspace. -### subproject.name() +### package.name(), subproject.name() ```meson name = pkg.name() ``` -Returns the name of the subproject. +Returns the name of a package or subproject. -### subproject.version() +### package.version(), subproject.version() ```meson version = pkg.version() @@ -274,7 +287,7 @@ version = pkg.version() Returns the normalized version number of the subproject. -### subproject.api() +### package.api(), subproject.api() ```meson api = pkg.api() @@ -283,21 +296,21 @@ api = pkg.api() Returns the API version of the subproject, that is the version up to the first nonzero element. -### subproject.features() +### package.features(), subproject.features() ```meson features = pkg.features() ``` -Returns selected features for a specific subproject. +Returns selected features for a specific package or subproject. -### subproject.all_features() +### package.all_features(), subproject.all_features() ```meson all_features = pkg.all_features() ``` -Returns all defined features for a specific subproject. +Returns all defined features for a specific package or subproject. ### subproject.dependency() -- cgit v1.2.3