Questions tagged [rustdoc]

rustdoc is the documentation generator for the Rust programming language.

75 questions
0
votes
1 answer

How to link to a specific section in Rust documentation

Suppose I place a header in the documentation for a Rust module, src/module_a/mod.rs: # Header Some text. I know how to link to this header from other parts of src/module_a/mod.rs using standard markdown syntax, and I know how to link to module_a…
GHPR
  • 45
  • 6
0
votes
0 answers

Autogenerated noise in rustdoc when `--document-private-items`

When generating rustdoc with --document-private-items for my binary, it creates tons of unintended noise such as can be seen in the images below. It seems that these are generated by slog::info macro (docs.rs/slog/latest/slog/macro.info.html). Any…
Samuel Hapak
  • 6,950
  • 3
  • 35
  • 58
0
votes
0 answers

Rustdoc, link to crate not used within the project

I have two crates: my-library-crate and my-binary-crate. my-binary-crate depends on my-library-crate, but (naturally), not the other way around. I would love to mention references to my-binary-crate within my-library-crate docs. Something like…
Samuel Hapak
  • 6,950
  • 3
  • 35
  • 58
0
votes
1 answer

How can I run the rustdoc lints on every crate in my workspace?

Rustdoc offers some pretty useful lints for documentation. I'd like to check these lints as part of continuous integration for all of the crates in my Cargo workspace. Unfortunately, I've not been able to find a way to run these lints for all of my…
Derek Thurn
  • 14,953
  • 9
  • 42
  • 64
0
votes
0 answers

Simplest zoomable/panable svg display?

I am making a dependency graph of a rust project, whose documentation is emitted as pure html. I am wondering if there is a simple way to modify the html to insert an svg image in an interactive window with panning and zooming, the way it works on…
Makogan
  • 8,208
  • 7
  • 44
  • 112
0
votes
2 answers

links show as unused imports

Is there a way to include something into documentation scope without including it into the code scope? My Rustdoc links to a Trait that's not in the code scope. If I add use std::ops::Add at the top, I get unused import warning from cargo build. If…
Yuri Astrakhan
  • 8,808
  • 6
  • 63
  • 97
0
votes
1 answer

What does the `tags` variable come from in the diesel documentation?

I'm looking at the official Diesel documentation on this page: https://docs.diesel.rs/diesel/expression_methods/trait.PgArrayExpressionMethods.html#example. The example uses a variable tags, but I cannot see where it is defined. How should I…
Dolphin
  • 29,069
  • 61
  • 260
  • 539
0
votes
1 answer

Showing a matrix in rust doc comments

I would like to show a matrix (mathematical entity) in rust doc comments. I tried using this: /** For example, given the projection matrix: 1 0 0 0 1 0 0 0 1 0 0 0 1 0 0 0 */ While…
l3utterfly
  • 2,106
  • 4
  • 32
  • 58
0
votes
1 answer

Combining doctests and `extern crate`

In Rust 2018 I can use extern self as crate_name and then use fully-qualified syntax, for example extern crate self as crate_name; //set our crate name pub struct Member; fn test() { ::crate_name::Member; //use fully-qualified name } However I…
Drew
  • 8,675
  • 6
  • 43
  • 41
0
votes
1 answer

Missing snippets in The Rust Programming Language book

I'm trying to download The Rust Programming Language book in epub format using the mdbook-epub tool, but the output file doesn't contain any code snippets. Instead it has placeholders like this: {{#include…
alf
  • 18,372
  • 10
  • 61
  • 92
0
votes
0 answers

Not able to see documentation for my crate functions

I'm writing my first binary crate with Rust and though I have documentation comments for all functions, none of the functions show up in the documentation after running cargo doc --no-deps. The only entry I see in the docs is the name of my crate…
myTerminal
  • 1,596
  • 1
  • 14
  • 31
0
votes
0 answers

How to order documentation comments for a type coming from multiple impl blocks in different modules?

I have a struct and its implementation defined in main.rs and complementary implementations defined in other modules: /// Bla bla. pub struct Data { val: i32, } /// Primary functions. impl Data { pub fn new(val: i32) -> Data { Data { val }…
Shadok
  • 144
  • 5
0
votes
0 answers

Is there a way to document private fields?

I have a struct where all fields are private, because they should be set using public setters. It feels awkward to document the setter with a description of the field it sets. Is there a way to document and show a private field on rustdoc?
Jonathan Woollett-light
  • 2,813
  • 5
  • 30
  • 58
0
votes
1 answer

How do you handle the "could not parse code block as Rust code" rustdoc warning?

I'm writing some rust doc examples (that are compiling): /// ```rust /// # #[macro_use] /// # extern crate ... /// ... /// ``` But cargo doc gives me this [incorrect] warning: warning: could not parse code block as Rust code -->…
Nicole
  • 29
  • 4
0
votes
1 answer

Why does a rustdoc test with unsafe code fail but the same code in an integration test passes?

I am trying to write a rustdoc test of a method called insert. The testing function is called in the last line of the test, and when I comment it out the test passes just fine. Error message: $ cargo test Compiling reproduce v0.1.0…
rect0x51
  • 605
  • 1
  • 6
  • 11
1 2 3 4
5