Template:Doc

From Rust Community Wiki
Jump to navigation Jump to search

Links to documentation for official Rust crates.

Template parameters

ParameterDescriptionTypeStatus
Relative URL1

The relative URL to the item without a slash at the start.

Example
std/iter/trait.Iterator.html
Stringrequired
Displayed text2

The text to display on the link.

Stringrequired
Title3

Displayed text when the link is hovered

Stringoptional

Example[edit source]

  • {{Doc|std/iter/trait.Iterator.html|Iterator}} becomes IteratorThis links to official Rust documentation
  • {{Doc|std/iter/trait.Iterator.html|Iterator|Some text}} becomes IteratorThis links to official Rust documentation

Shortcuts[edit source]

Typing out {{Doc|std/foo|Bar}} is long, so shortcuts exist for std, alloc and core that can be used like so: {{std|foo|Bar}}.

Furthermore, there are shortcuts for traits, structs and enums that are even shorter and more readable, e.g. {{trait|core::ops::Add}}, {{struct|alloc::boxed::Box}}, {{enum|core::result::Result}}. For these templates, the name and title is set automatically.