Function expand_contract_clause

Source
fn expand_contract_clause(
    ecx: &mut ExtCtxt<'_>,
    attr_span: Span,
    annotated: TokenStream,
    inject: impl FnOnce(&mut TokenStream) -> Result<(), ErrorGuaranteed>,
) -> Result<TokenStream, ErrorGuaranteed>
Expand description

Expand the function signature to include the contract clause.

The contracts clause will be injected before the function body and the optional where clause. For that, we search for the body / where token, and invoke the inject callback to generate the contract clause in the right place.