The rust
plugin is useful for building Rust-based parts using the Cargo package manager to drive the build. This plugin uses the common plugin keywords as well as those for sources. For more information, see Snapcraft parts metadata.
Additional features and syntax are dependent on which base is being used, as outlined below:
See Rust applications for a simple example, or search GitHub for projects using the plugin.
ⓘ This is a snapcraft plugin. See Snapcraft plugins and Supported plugins for further details on how plugins are used.
base: core24 | core22
rust-features
(list of strings) Features used to build optional dependenciesrust-path
(list of strings) Defaults to the current working directory. Can be set to the relative path for the crate to build when using workspaces. Only one item is currently supported.
Requires Snapcraft version 8.0+ for core24
.
Requires Snapcraft version 7.0+ for core22
.
base: core20
rust-features
(list of strings) Features used to build optional dependenciesrust-path
(list of strings) Defaults to the current working directory. Can be set to the relative path for the crate to build when using workspaces. Only one item is currently supported.
Requires Snapcraft version 4.0+.
base: core18 | core
rust-channel
(string) Used to select which rust channel (stable, beta, nightly)rust-features
(list of strings) Features used to build optional dependenciesrust-revision
(string) Used to select which rust version
If a rust-toolchain file is detected, the toolchain it specifies will be used by default. However, if rust-channel
or rust-revision
are set, the rust-toolchain file will be overridden.
If neither a rust-toolchain exists nor rust-channel
or rust-revision
are set, the latest stable toolchain will be used.
Requires Snapcraft version 3.x+.