mirror of
https://github.com/alrayyes/wiki.git
synced 2024-11-22 03:26:22 +00:00
1.2 KiB
1.2 KiB
date | id | title |
---|---|---|
20201119 | f739a5a0-36a6-4a06-8890-91ec5fa84585 | Linking To Items By Name |
Description
rustdoc has syntax to specifiy that you're trying to link to a type, and it will generate URLs for you. No more relative linking with all the issues it brings.
Syntax
Pre 1.48
pub mod foo {
/// Some docs for `Foo`
///
/// You may want to use `Foo` with [`Bar`].
///
/// [`Bar`]: ../bar/struct.Bar.html
pub struct Foo;
}
pub mod bar {
/// Some docs for `Bar`
///
/// You may want to use `Bar` with [`Foo`].
///
/// [`Foo`]: ../foo/struct.Foo.html
pub struct Bar;
}
1.48
pub mod foo {
/// Some docs for `Foo`
///
/// You may want to use `Foo` with [`Bar`](crate::bar::Bar).
pub struct Foo;
}
pub mod bar {
/// Some docs for `Bar`
///
/// You may want to use `Bar` with [`crate::foo::Foo`].
pub struct Bar;
}