The rust plugin

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.

Additionally, this plugin uses the following plugin-specific keywords:

  • rust-channel (string)
    Used to select which rust channel (stable, beta, nightly)
  • rust-features (list of strings)
    Features used to build optional dependencies
  • rust-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.

See Rust applications for a simple example, or search GitHub for projects already using the plugin.

NOTE: There are significant bugs in the rust plugin when used with the legacy version of Snapcraft. To avoid these issues, ensure you’re using Snapcraft 3.x and the base keyword in snapcraft.yaml. See the corresponding GitHub issue for more details.

This is a snapcraft plugin. See Snapcraft plugins and Supported plugins for further details on how plugins are used.

Last updated 2 months ago. Help improve this document in the forum.