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

tonic-disable-doctest

Disable doctest in autogenerated code preserving docstring

1 unstable release

0.1.0 May 25, 2023

#6 in #doctest

Download history 26/week @ 2024-01-08 63/week @ 2024-01-15 42/week @ 2024-01-22 26/week @ 2024-01-29 13/week @ 2024-02-05 11/week @ 2024-02-12 10/week @ 2024-02-19 70/week @ 2024-02-26 24/week @ 2024-03-04 91/week @ 2024-03-11 18/week @ 2024-03-18 10/week @ 2024-03-25 83/week @ 2024-04-01 77/week @ 2024-04-08 5/week @ 2024-04-22

166 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
~58K SLoC