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

tonic-disable-doctest

Disable doctest in autogenerated code preserving docstring

2 unstable releases

0.2.0 Feb 10, 2025
0.1.0 May 25, 2023

#1069 in Development tools

Download history 1/week @ 2024-10-29 7/week @ 2024-11-05 7/week @ 2024-11-19 1/week @ 2024-11-26 11/week @ 2024-12-03 6/week @ 2024-12-10 38/week @ 2024-12-24 12/week @ 2024-12-31 31/week @ 2025-01-07 2/week @ 2025-01-14 28/week @ 2025-01-21 133/week @ 2025-01-28 119/week @ 2025-02-04 78/week @ 2025-02-11

358 downloads per month

MIT license

8KB
74 lines

tonic-disable-doctest

crates.io Released API docs MIT licensed

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

~1.4–2MB
~38K SLoC