#extension #doctest #codegen #struct #disable #autogenerated #tonic-build

tonic-disable-doctest

Disable doctest in autogenerated code preserving docstring

1 unstable release

0.1.0 May 25, 2023

#7 in #doctest

Download history 95/week @ 2024-03-13 12/week @ 2024-03-20 30/week @ 2024-03-27 83/week @ 2024-04-03 54/week @ 2024-04-10 5/week @ 2024-04-24 9/week @ 2024-05-01 8/week @ 2024-05-08 20/week @ 2024-05-15 1/week @ 2024-05-22 6/week @ 2024-05-29 24/week @ 2024-06-05 16/week @ 2024-06-12 130/week @ 2024-06-19 31/week @ 2024-06-26

203 downloads per month

MIT license

7KB
74 lines

tonic-disable-doctest

Separate docstring for specific structs autogenerated by tonic_build. This may be handy in cases where comments for autogeneration input contain code that will be incorrectly treated as rust code and you have no control over the input. This will disable doctest of these docs while retaining the docstring in a separate struct.


lib.rs:

Extension for tonic_build allowing for disabling doctest for specific struct

Allows to separate docstring for specific structs autogenerated by tonic_build. This may be handy in cases where comments for autogeneration input contain code that will be incorrectly treated as rust code and you have no control over the input. This extension gives way to disable doctest of these docs while retaining the docstring in a separate struct linked by the docstring in original struct.

After using this hack full doctest run should pass even if autogenerated code normally contained offending parts that caused it to fail. E.g. in SO question

Dependencies

~3MB
~59K SLoC