Next: , Previous: , Up: Diretrizes de empacotamento   [Contents][Index]


22.4.10 Rust Crates

Rust programs standing for themselves are named as any other package, using the lowercase upstream name.

To prevent namespace collisions we prefix all other Rust packages with the rust- prefix. The name should be changed to lowercase as appropriate and dashes should remain in place.

In the rust ecosystem it is common for multiple incompatible versions of a package to be used at any given time, so all package definitions should have a versioned suffix. The versioned suffix is the left-most non-zero digit (and any leading zeros, of course). This follows the “caret” version scheme intended by Cargo. Examples rust-clap-2, rust-rand-0.6.

Because of the difficulty in reusing rust packages as pre-compiled inputs for other packages the Cargo build system (see cargo-build-system) presents the #:cargo-inputs and cargo-development-inputs keywords as build system arguments. It would be helpful to think of these as similar to propagated-inputs and native-inputs. Rust dependencies and build-dependencies should go in #:cargo-inputs, and dev-dependencies should go in #:cargo-development-inputs. If a Rust package links to other libraries then the standard placement in inputs and the like should be used.

Care should be taken to ensure the correct version of dependencies are used; to this end we try to refrain from skipping the tests or using #:skip-build? when possible. Of course this is not always possible, as the package may be developed for a different Operating System, depend on features from the Nightly Rust compiler, or the test suite may have atrophied since it was released.