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

tonic-disable-doctest

Disable doctest in autogenerated code preserving docstring

1 unstable release

0.1.0 May 25, 2023

#8 in #doctest

25 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

~2.5MB
~58K SLoC