Skip to main content

add_code

Attribute Macro add_code 

Source
#[add_code]
Expand description

This is handy for keeping docify-generated examples clean while still inserting setup/teardown or assertions for tests.

§Syntax

#[add_code(before = { /* statements */ })]
#[add_code(after = { /* statements */ })]
#[add_code(before = { ... }, after = { ... })]
fn demo() { /* ... */ }

The statements inside the braces are inserted without the outer {}.