API docs generation for lib.rs

I have some library, where want to generate some API request/response dumps to markdown file, but not sure how to make it:

  • maybe I want create main.rs file for this library and run it using some arguments, e.g. --build-docs
  • or maybe I should use some trait or crate for these needs..

p.s. that's is not exactly docs in common meaning, just the auto-dump of API responses that library methods provide

To integrate custom helper commands into a rust project workspace, you could consider the cargo xtask pattern.

1 Like