Attribute Macro item

Source
#[item]
Expand description

Generate C header content from the docstring on this item.

§Docstring Parsing

The generated C header content contains C-style comments with the content of the Rust docstring.

Any blocks delimited by triple-backticks with the c type will be included in the header as C code. This should give the C declaration for the Rust item.

§Ordering

The header file is generated by concatenating the content supplied by this macro any by ffizz_header::snippet!. Each piece of content has “order” and “name” properties, and these are used to sort the content in the header file. The name must also be unique within the resulting library. The “order” property defaults to 100 and “name” defaults to the name of the Rust item. Both can be overridden with a ffizz attribute:

#[ffizz(name="FOO_free")]
#[ffizz(order=200)]
#[ffizz(name="FOO_free", order=200)]

§Example

#[ffizz_header::item]
/// Free a foo_t.  The given foo_t must not be used after this
/// call.
///
/// ```c
/// void foo_free(*foo_t);
/// ```
pub unsafe extern "C" fn foo_free(*mut foo_t) { .. }

produces

// Free a foo_t.  The given foo_t must not be used after this
// call.
void foo_free(*foo_t);