Skip to main content

expand_impl

Function expand_impl 

Source
pub fn expand_impl(attr: TokenStream, item: TokenStream) -> TokenStream
Expand description

Top-level entry point for expanding #[miniextendr] on impl blocks.

Dispatches between two cases:

  1. Inherent impls (impl Type { ... }): Parses ImplAttrs and ParsedImpl, then generates C wrappers, R wrapper code, R_CallMethodDef arrays, and as.<class>() trait impls for the chosen class system.
  2. Trait impls (impl Trait for Type { ... }): Generates trait ABI vtables, cross-package shims, and R wrappers via expand_miniextendr_impl_trait.

§Arguments

  • attr - The token stream inside #[miniextendr(...)] (class system, options)
  • item - The full impl block token stream

§Returns

A token stream containing the original impl block (with miniextendr attrs stripped), C wrapper functions, an R wrapper string constant, a R_CallMethodDef array constant, and any forwarding trait impls for as.<class>() coercion.