@use crate::templates::base; @use crate::install_page::InstallPage; @use crate::Urler; @use rich_crate::Origin; @(url: &Urler, c: &InstallPage) @:base(&c.page(), {
@if c.ver.is_yanked() {

This crate is yanked (soft-deleted), so it can't be installed any more.

} else { @if c.ver.is_nightly() {

This crate requires a nightly (unstable, experimental) compiler version. To switch to it, you must have Rust installed via Rustup, and run:

rustup default nightly

Run rustup default stable to switch back.

} @if c.ver.has_bin() && c.ver.has_lib() {

@c.ver.capitalized_name() is both an executable binary that can be run, and a library that can be used in Rust programs.

} @if c.ver.is_proc_macro() {

@c.ver.capitalized_name() is a procedural macro. It will run at compile time and transform your program's source code.

} @if c.ver.has_bin() { @if let Some(bins) = Some(c.ver.bin_names()) { @if bins.len() == 1 {

Installing the @if bins[0] == c.ver.short_name() {command-line} else {@bins[0]} executable

} else {

Installing @for bin in &bins {@bin } executables

}

Assuming you have Rust/Cargo installed, run this command in a terminal:

@if let Origin::CratesIo(_) = c.ver.origin() {
cargo install -f @c.ver.short_name()
} @if let Some((repo, package)) = c.ver.origin().clone().into_repo() {
cargo install -f @package --git @repo.canonical_git_url().unwrap()
}

It will make @if bins.len()==1 {the } @for bin in &bins {@bin } command@if bins.len()>1 {s} available in your PATH if you've allowed the PATH to be modified when installing Rust. cargo uninstall @c.ver.short_name() uninstalls.

} } @if c.ver.has_lib() {

Adding @c.ver.lib_name() library as a dependency

@if c.ver.short_name() != "cargo-edit" {

If you have cargo-edit installed, run this command in a terminal, in your project's directory:

@if c.is_build { @if let Origin::CratesIo(name) = c.ver.origin() {
cargo add --build @name
} @if let Some((repo, package)) = c.ver.origin().clone().into_repo() {
cargo add --build @package --git @repo.canonical_git_url().unwrap()
}

to add @c.ver.lib_name() as a build-time dependency. To add it as a run-time dependency, run:

} else {@if c.is_dev { @if let Origin::CratesIo(name) = c.ver.origin() {
cargo add --dev @name
} @if let Some((repo, package)) = c.ver.origin().clone().into_repo() {
cargo add --dev @package --git @repo.canonical_git_url().unwrap()
}

to add it a dev dependency (if it's used only in tests, not in the final product). To add it as a regular run-time dependency, run:

}} @if let Origin::CratesIo(name) = c.ver.origin() {
cargo add @name
} @if let Some((repo, package)) = c.ver.origin().clone().into_repo() {
cargo add @package --git @repo.canonical_git_url().unwrap()
} }

To add it manually, edit your project's Cargo.toml file and add to the @if c.is_build {[build-dependencies] or} [dependencies] section:

@if let Origin::CratesIo(_) = c.ver.origin() {
@c.ver.short_name() = "@c.ver.version()"
} @if let Some((repo, package)) = c.ver.origin().clone().into_repo() {
@package = @"{" git = "@repo.canonical_git_url().unwrap()" @"}"
}

The @c.ver.lib_name() library will automatically available globally. @if let Some(url) = c.api_reference_url() { Read the @c.ver.lib_name() library documentation. }

} @if c.ver.is_proc_macro() && !c.ver.has_lib() {

Adding @c.ver.short_name() macro(s) as a dependency

If you have cargo-edit installed, run this command in a terminal, in your project's directory:

@if let Origin::CratesIo(name) = c.ver.origin() {
cargo add @name
} @if let Some((repo, package)) = c.ver.origin().clone().into_repo() {
cargo add @package --git @repo.canonical_git_url().unwrap()
}

To add it manually, edit your project's Cargo.toml file and add to the [dependencies] section:

@if let Origin::CratesIo(_) = c.ver.origin() {
@c.ver.short_name() = "@c.ver.version()"
} @if let Some((repo, package)) = c.ver.origin().clone().into_repo() {
@package = @"{" git = "@repo.canonical_git_url().unwrap()" @"}"
}

You may need to import the macro(s) with use @c.ver.lib_name()::*.

@if let Some(url) = c.api_reference_url() { Read the @c.ver.lib_name() documentation. }

}}

Back to the crate overview.


@if let Some(readme) = c.ver.readme() {
}
})