Search code examples
rustrustdoc

Can I externalize parts of a Rust documentation test to an external file?


When writing Rust documentation tests, is it possible to externalize parts of the code to an external file to keep the example short?


Solution

  • # include!("src/fragment.rs") appears to work and does not show up in the output. I have no idea how this interferes with Cargo's dependency processing, though.