How can I write a line into the documenation code but let the compiler ignore it?
I want to write
/// # Examples
///
/// To clone something, do
///
/// ```
/// IGNORE_FOR_COMPILATION_BUT_SHOW: let cloned = myValue.clone();
/// # let cloned = 5.clone();
/// ```
And I want to get:
Examples
To clone somthing, do
let cloned = myValue.clone();
But the compiler should still compile the example (cloning the 5).
EDIT: I also want cargo to run the example, but leave out one line.
ignore
after the first three backticks. – SandpipermyValue
(Could be fixed in this example by adding a let). What I need it for is to use an associated method of a trait on a type which I do not want to show in the documentation because it is not restricted to that one. – Slovene