Cargo Use plugin¶
The Cargo Use plugin sets up a local cargo registry for Rust crates. It’s a companion plugin meant to be used with the Rust plugin. It affects all Rust parts in a project.
Keys¶
This plugin provides the following unique keys.
Dependencies¶
The cargo-use plugin has no dependencies.
How it works¶
During the build step the plugin performs the following actions:
Setup a local cargo registry if it has not been setup;
Copy sources from
<source-dir>to the local cargo registry dir;Add an empty
.cargo-checksum.jsonfile to satisfy registry requirements;
Examples¶
The following snippet declares a pair of parts.
The first is named librust-cfg-if and uses the cargo-use plugin.
The second, the app of the pair, is named hello and uses the rust plugin. The
app’s source has cfg-if as a dependency, which is why the librust-cfg-if part is
needed. The after key in the hello part establishes the correct ordering of
these parts, ensuring that librust-cfg-if is processed first.
parts:
librust-cfg-if:
source: https://github.com/rust-lang/cfg-if.git
source-tag: 1.0.0
plugin: cargo-use
hello:
build-snaps:
- rustup
plugin: rust
source: .
after:
- librust-cfg-if