diff options
author | Peter Hutterer <peter.hutterer@who-t.net> | 2023-07-19 09:30:06 +1000 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2023-07-18 19:49:08 -0400 |
commit | 1502b90f3a2d3557e0461d27f49b2f29aed46474 (patch) | |
tree | 8572f7ff09d59fd0478a3b58e3807c0e11b8c26b | |
parent | f9debd3ae24a772056f19aa5f0746661f2259f6b (diff) | |
download | meson-1502b90f3a2d3557e0461d27f49b2f29aed46474.zip meson-1502b90f3a2d3557e0461d27f49b2f29aed46474.tar.gz meson-1502b90f3a2d3557e0461d27f49b2f29aed46474.tar.bz2 |
docs: improve formatting of the Rust module
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.
-rw-r--r-- | docs/markdown/Rust-module.md | 37 |
1 files changed, 20 insertions, 17 deletions
diff --git a/docs/markdown/Rust-module.md b/docs/markdown/Rust-module.md index d606629..bbc92fc 100644 --- a/docs/markdown/Rust-module.md +++ b/docs/markdown/Rust-module.md @@ -18,7 +18,11 @@ like Meson, rather than Meson work more like rust. ## Functions -### test(name: string, target: library | executable, dependencies: []Dependency, link_with: []targets, rust_args: []string) +### test() + +```meson +rustmod.test(name, target, ...) +``` This function creates a new rust unittest target from an existing rust based target, which may be a library or executable. It does this by @@ -26,19 +30,18 @@ copying the sources and arguments passed to the original target and adding the `--test` argument to the compilation, then creates a new test target which calls that executable, using the rust test protocol. -This accepts all of the keyword arguments accepted by the -[[test]] function except `protocol`, it will set -that automatically. +This function takes two positional arguments, the first is the name of the +test and the second is the library or executable that is the rust based target. +It also takes the following keyword arguments: -Additional, test-only dependencies may be passed via the `dependencies` -argument. +- `dependencies`: a list of test-only Dependencies +- `link_with`: a list of additional build Targets to link with (*since 1.2.0*) +- `rust_args`: a list of extra arguments passed to the Rust compiler (*since 1.2.0*) -*(since 1.2.0)* the `link_with` argument can be used to pass additional build -targets to link with -*(since 1.2.0)* the `rust_args` keyword argument can be used to pass extra -arguments to the Rust compiler. +This function also accepts all of the keyword arguments accepted by the +[[test]] function except `protocol`, it will set that automatically. -### bindgen(*, input: string | BuildTarget | [](string | BuildTarget), output: string, include_directories: [](include_directories | string), c_args: []string, args: []string, dependencies: []Dependency) +### bindgen() This function wraps bindgen to simplify creating rust bindings around C libraries. This has two advantages over invoking bindgen with a @@ -51,14 +54,14 @@ libraries. This has two advantages over invoking bindgen with a It takes the following keyword arguments -- `input` — A list of Files, Strings, or CustomTargets. The first element is +- `input`: a list of Files, Strings, or CustomTargets. The first element is the header bindgen will parse, additional elements are dependencies. -- `output` — the name of the output rust file -- `include_directories` — A list of `include_directories` or `string` objects, +- `output`: the name of the output rust file +- `include_directories`: A list of `include_directories` or `string` objects, these are passed to clang as `-I` arguments *(string since 1.0.0)* -- `c_args` — A list of string arguments to pass to clang untouched -- `args` — A list of string arguments to pass to `bindgen` untouched. -- `dependencies` — A list of `Dependency` objects to pass to the underlying clang call (*since 1.0.0*) +- `c_args`: a list of string arguments to pass to clang untouched +- `args`: a list of string arguments to pass to `bindgen` untouched. +- `dependencies`: a list of `Dependency` objects to pass to the underlying clang call (*since 1.0.0*) ```meson rust = import('unstable-rust') |