doc/../rust.section.md: fix incorrect header depths

The headings for the Rust section are structured incorrectly in two ways:

1. The section "Compiling non-Rust packages that include Rust code" is totally specific to `buildRustPackage`.  It should be a child of the "Compiling Rust applications with Cargo" section.
1. The section "Setting up `nix-shell`" is totally specific to `buildRustCrate`.  It should be a child of the "Compiling Rust crates using Nix instead of Cargo" section.

- Rust
  - Compiling Rust applications with Cargo
    - ...
  - Compiling non-Rust packages that include Rust code
    - ...
  - Compiling Rust crates using Nix instead of Cargo
    - ...
  - Setting Up `nix-shell`
    - ...

- Rust
  - Compiling Rust applications with Cargo
    - ...
    - Compiling non-Rust packages that include Rust code
      - ...
  - Compiling Rust crates using Nix instead of Cargo
    - ...
    - Setting Up `nix-shell`
      - ...
This commit is contained in:
Adam Joseph 2022-08-22 14:29:50 -07:00
parent efbbdc16e6
commit 50f57ac692

View file

@ -411,13 +411,13 @@ rustPlatform.buildRustPackage rec {
}
```
## Compiling non-Rust packages that include Rust code {#compiling-non-rust-packages-that-include-rust-code}
### Compiling non-Rust packages that include Rust code {#compiling-non-rust-packages-that-include-rust-code}
Several non-Rust packages incorporate Rust code for performance- or
security-sensitive parts. `rustPlatform` exposes several functions and
hooks that can be used to integrate Cargo in non-Rust packages.
### Vendoring of dependencies {#vendoring-of-dependencies}
#### Vendoring of dependencies {#vendoring-of-dependencies}
Since network access is not allowed in sandboxed builds, Rust crate
dependencies need to be retrieved using a fetcher. `rustPlatform`
@ -477,7 +477,7 @@ added. To find the correct hash, you can first use `lib.fakeSha256` or
`lib.fakeHash` as a stub hash. Building `cargoDeps` will then inform
you of the correct hash.
### Hooks {#hooks}
#### Hooks {#hooks}
`rustPlatform` provides the following hooks to automate Cargo builds:
@ -513,7 +513,7 @@ you of the correct hash.
* `bindgenHook`: for crates which use `bindgen` as a build dependency, lets
`bindgen` find `libclang` and `libclang` find the libraries in `buildInputs`.
### Examples {#examples}
#### Examples {#examples}
#### Python package using `setuptools-rust` {#python-package-using-setuptools-rust}
@ -863,7 +863,7 @@ features, we would write:
Where `diesel.nix` is the file generated by Carnix, as explained above.
## Setting Up `nix-shell` {#setting-up-nix-shell}
### Setting Up `nix-shell` {#setting-up-nix-shell}
Oftentimes you want to develop code from within `nix-shell`. Unfortunately
`buildRustCrate` does not support common `nix-shell` operations directly