summaryrefslogtreecommitdiff
path: root/docs/markdown/Rust-module.md
AgeCommit message (Collapse)Author
2025-12-22docs: update info on Cargo workspace objectPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22modules: rust: add package.override_dependency methodPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22modules: rust: add package.shared_module methodPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22modules: rust: add package.executablePaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22modules: rust: add package.library/package.proc_macro methodsPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22modules: rust: add dependencies() method to package objectPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22rust: add to_system_dependencyPaolo Bonzini
Move the logic for system dependencies outside Cargo.interpreter and into the rust module, so that it can be reused by the workspace object. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22modules: rust: add workspace methods returning arguments for build targetsPaolo Bonzini
Add rustc_args(), env(), and rust_dependency_map() methods to the RustPackage class. They simply delegate to PackageState and PackageConfiguration. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22modules: rust: implement workspace.package()Paolo Bonzini
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 <pbonzini@redhat.com>
2025-12-22modules: rust: implement more package accessorsPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22modules: rust: implement workspace.packages()Paolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22modules: rust: implement workspace.subproject() and package.dependency()Paolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22cargo: add configurable features to InterpreterPaolo Bonzini
Add features property to cargo.Interpreter to make default features configurable; customization of which features are enabled by default is triggered by rust.workspace(). Fixes: #14290 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-12-22rust: add rust.workspace() skeleton implementationPaolo Bonzini
rust.workspace() is the entry point for global feature resolution. It loads a Cargo.toml file and ensures that all dependencies will be built with the correct set of features. Fixes: #13404 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-10-08doc: fix bindgen exampleMarc-André Lureau
Signed-off-by: Marc-André Lureau <marcandre.lureau@redhat.com>
2025-04-20move "since 1.8.0" for rust.doctest to the right placePaolo Bonzini
2025-04-02rust: add link_whole to rust.test and rust.doctestPaolo Bonzini
QEMU needs it in its integration tests (in order to run global constructors), and therefore in rust.doctest too. With this change I could do: # Rust executables do not support objects, so add an intermediate step. rust_qemu_api_objs = static_library( 'rust_qemu_api_objs', objects: [libqom.extract_all_objects(recursive: false), libhwcore.extract_all_objects(recursive: false)]) rust.doctest('rust-qemu-api-doc', _qemu_api_rs, dependencies: [qemu_api, qemu_api_macros], link_with: libqemuutil, link_whole: [rust_qemu_api_objs], suite: ['doc', 'rust']) followed by "meson test --suite doc". For completeness, add it to rust.test as well. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2025-04-02rust: add rust.doctestPaolo Bonzini
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2024-02-24meson/rust: wrap `bindgen`s `wrap-static-fns` functionalityKarol Herbst
This way the `rust.bindgen` can generate a second output being a C file, which contains wrapper functions for static inline ones. This output file can then be compiled via C targets.
2024-02-23modules/rust: allow setting a version constraint on bindgenDylan Baker
This allows us to ensure that the bindgen we're using is suitable for our purpose.
2024-02-23modules/rust: Allow explicitly setting the language to bindDylan Baker
This may be of particular use when a header is .h but should be treated as a C++ header instead of a C header.
2023-11-22docs: fix bindgen_clang_arguments exampleAlyssa Ross
> error: unsupported option '--target'; did you mean '-target'?
2023-09-19Rust: Add a rust.proc_macro() methodDylan Baker
2023-07-18docs: improve formatting of the Rust modulePeter Hutterer
This brings the formatting more in line with other modules, in particular the headers do not include the full function signature for readability, keyword arguments are listed one-by-one, etc.
2023-07-18docs: fix typos and keyword markdown for the Rust module pagePeter Hutterer
Two typos and mark the keyword arguments with backticks so they render nicely.
2023-06-27modules/rust: Add a keyword argument to pass extra args to the rust compilerDylan Baker
This may be necessary to, for example, stop rustc complaining about unused functions
2023-06-27modules/rust: Add a machine file property for extra clang args with bindgenDylan Baker
It's currently impossible to inject extra clang arguments when using bindgen, which is problematic when cross compiling since you may need critical arguments like `--target=...`. Because such arguments must be passed after the `--` it's impossible to inject them currently without going to something like a wrapper script. Fixes: #11805
2023-06-27modules/rust: Add a `link_with` kwarg to the test methodDylan Baker
This was requested by Mesa, where a bunch of `declare_dependency` objects are being created as a workaround for the lack of this keyword
2023-04-21docs: update the Rust bindgen docs to talk about assertionsDylan Baker
Since we now guarantee that Rust and C/C++ will have assertions both on or both off, we can give guidance about using `cfg(debug_assertions)` to wrap code using `#ifdef NDEBUG`.
2023-04-11fix various spelling issuesJosh Soref
Signed-off-by: Josh Soref <2119212+jsoref@users.noreply.github.com>
2022-12-11DOCS: Rust-module: Remove note about unstable APIEwout ter Hoeven
Remove the note about the unstable API of the Rust module, since it's no longer unstable as of Meson 1.0.0.
2022-12-05modules/rust: Add support for dependencies in bindgenDylan Baker
This is needed for cases where we need external C headers, which are passed to clang.
2022-12-05modules/rust: Add support for string include_directoriesDylan Baker
Which we support for basically every other case, but not this one.
2022-11-19modules/rust: stabilizeDylan Baker
Mesa is using the rust module in production, so we should stabilize it.
2022-01-10docs: fix rust module bindgen argumentsDylan Baker
Fixes: 9795
2021-10-10Fix typos discovered by codespellChristian Clauss
2021-10-03docs: Fix broken linksDaniel Mensinger
2021-05-18doc: Fix array syntax [skip ci]Tim McNamara
Adds a square bracket to create a valid array.
2021-02-06rust: Add a module wrapper for bindgenDylan Baker
This has a couple of advantages over rolling it by hand: 1. it correctly handles include_directories objects, which is always handy 2. it correctly generates a depfile for you, which makes it more reliable 3. it requires less typing
2021-01-31Capitalize "Meson" consistently as it is a proper name. [skip ci]Jussi Pakkanen
2021-01-30Rewrap long text lines in docs. [skip ci]Jussi Pakkanen
2021-01-05modules: Add an unstable-rust moduleDylan Baker
Like other language specific modules this module is module for holding rust specific helpers. This commit adds a test() function, which simplifies using rust's internal unittest mechanism. Rust tests are generally placed in the same code files as they are testing, in contrast to languages like C/C++ and python which generally place the tests in separate translation units. For meson this is somewhat problematic from a repetition point of view, as the only changes are generally adding --test, and possibly some dependencies. The rustmod.test() method provides a mechanism to remove the repatition: it takes a rust target, copies it, and then addes the `--test` option, then creates a Test() target with the `rust` protocol. You can pass additional dependencies via the `dependencies` keyword. This all makes for a nice, DRY, test definition.