Open Tehforsch opened 8 months ago
Have you considered scraping examples for the inline documentation?
Have you considered scraping examples for the inline documentation?
Oh, nice - I didn't know about this feature. I don't think it will help with unit_system
, since it doesnt seem to scrape usage of proc macros, but this could be very useful for documenting some of the methods on quantity, because we could have many examples in one file and it shows only the small part of the example that applies to the function, so none of the ugly unstable features are shown.
At the moment, the doctests are a bit annoying to maintain and easy to forget about for a few reasons:
unit_system
macro in an internal module.lib.rs
doctests directly from the readme (because the lines starting with#
won't show when looking up the doctest, but they will show up in the readme).For these reasons, many of the doctests are currently set to
ignore
although they run fine (and I check every now and then by adding their setup code again).For 1-3 to I am not sure how to deal with this aside from adding a bit of machinery to generate these tests (and possibly generate a readme as well). Unfortunately adding some kind of prelude that can be included easily does not work for 1/2, since feature gates need to be declared on top of the doctest and the module also needs to be defined around the entire doctest.
I think 4 is dealt with by https://doc.rust-lang.org/beta/unstable-book/language-features/doc-cfg.html which seems easy enough to use.