summaryrefslogtreecommitdiff
path: root/mesonbuild/modules
diff options
context:
space:
mode:
Diffstat (limited to 'mesonbuild/modules')
-rw-r--r--mesonbuild/modules/rust.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/mesonbuild/modules/rust.py b/mesonbuild/modules/rust.py
index 86e3ce426..4c61b7e31 100644
--- a/mesonbuild/modules/rust.py
+++ b/mesonbuild/modules/rust.py
@@ -100,9 +100,17 @@ class RustWorkspace(ModuleObject):
self.interpreter = interpreter
self.ws = ws
self.methods.update({
+ 'packages': self.packages_method,
'subproject': self.subproject_method,
})
+ @noPosargs
+ @noKwargs
+ def packages_method(self, state: ModuleState, args: T.List, kwargs: TYPE_kwargs) -> T.List[str]:
+ """Returns list of package names in workspace."""
+ package_names = [pkg.manifest.package.name for pkg in self.ws.packages.values()]
+ return sorted(package_names)
+
def _do_subproject(self, pkg: cargo.PackageState) -> None:
kw: _kwargs.DoSubproject = {
'required': True,