summaryrefslogtreecommitdiff
path: root/docs/markdown/Rust.md
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2025-11-18 12:02:31 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2025-12-22 12:01:05 +0100
commit8e53ca4b796242a4fc366a263fab3adecf5e7151 (patch)
treefd37e6fcdcf2712568bb2de11987a7fe8f713f14 /docs/markdown/Rust.md
parent8d2676a49bdce134e3ee9d97f00e627b442dfa40 (diff)
downloadmeson-8e53ca4b796242a4fc366a263fab3adecf5e7151.tar.gz
docs: update info on Cargo workspace object
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'docs/markdown/Rust.md')
-rw-r--r--docs/markdown/Rust.md29
1 files changed, 24 insertions, 5 deletions
diff --git a/docs/markdown/Rust.md b/docs/markdown/Rust.md
index c93eadf02..1ca3d3a85 100644
--- a/docs/markdown/Rust.md
+++ b/docs/markdown/Rust.md
@@ -137,9 +137,28 @@ cargo_ws = rustmod.workspace(
features: ['feature1', 'feature2'])
```
-### Limitations
+Finally, the workspace object is able to build targets specified in `lib`
+or `bin` sections, extracting compiler arguments for dependencies and
+diagnostics from the Cargo.toml file. The simplest case is that of building
+a simple binary crate:
-All your own crates must be built using the usual Meson functions such as
-[[static_library]] or [[executable]]. In the future, workspace object
-functionality will be extended to help building rustc command lines
-based on features, dependency names, and so on.
+```meson
+cargo_ws.package().executable(install: true)
+```
+
+For a workspace:
+
+```meson
+pkg_lib = cargo_ws.package('myproject-lib')
+lib = pkg_lib.library(install: false)
+pkg_lib.override_dependency(declare_dependency(link_with: lib))
+
+cargo_ws.package().executable(install: true)
+```
+
+Sources are automatically discovered, but can be specified as a
+[[@structured_src]] if they are partly generated.
+
+It is still possible to use keyword arguments to link non-Rust build targets,
+or even to use the usual Meson functions such as [[static_library]] or
+[[executable]].