@@ -21,12 +21,13 @@ To build all API documentation for all crates in the
2121[ rust-random/rand] ( https://github.com/rust-random/rand ) repository, run:
2222
2323``` sh
24- # Build doc for all modules :
25- cargo doc --all --no-deps
24+ # Optionally, enable some unstable but widely used doc features :
25+ export RUSTDOCFLAGS= " --cfg docsrs -Zunstable-options --generate-link-to-definition "
2626
27- # And open it :
28- xdg-open target/ doc/rand/index.html
27+ # Build doc for all crates in the workspace :
28+ cargo doc --workspace --no-deps --all-features --open
2929```
30+ (Alternatively, check the ` Cargo.toml ` under ` [package.metadata.docs.rs] ` which may suggest workspace- or crate-specific configuration.)
3031
3132On Linux, it is easy to set up automatic rebuilds after any edit:
3233``` sh
@@ -39,9 +40,6 @@ After editing API documentation, we recommend testing examples:
3940cargo test --doc
4041```
4142
42- Rand API docs are automatically built and hosted at
43- [ rust-random.github.io/rand] for the latest code in master.
44-
4543### Getrandom crate
4644
4745The [ rust-random/getrandom] ( https://github.com/rust-random/getrandom )
@@ -64,12 +62,7 @@ When referring to an item from within another crate,
6462
65631 . if that item is accessible via a crate dependency (even if not via the
6664 public API), use the Rust item path
67- 2 . when linking to another crate within the ` rust-random/rand ` repository,
68- relative paths within the generated documentation files (under ` target/doc ` )
69- can be used; these work on [ rust-random.github.io/rand] but not
70- currently on ` docs.rs ` (see [ docs #204 ] )
71- 3 . if neither of the above are applicable, use an absolute link
72- 4 . consider revising documentation, e.g. refer to the crate instead
65+ 2 . otherwise, use an absolute link to docs.rs
7366
7467Examples:
7568
@@ -129,5 +122,4 @@ API documentation:
129122ln -s ../rand/target/doc rand
130123```
131124
132- [ rust-random.github.io/rand ] : https://rust-random.github.io/rand
133125[ docs#204 ] : https://github.com/rust-lang/docs.rs/issues/204
0 commit comments