Skip to main content

extract_module

Function extract_module 

Source
pub fn extract_module(item_mod: &ItemMod) -> Result<(Module, SourceMap)>
Expand description

Extract the module tree rooted at a #[weaveffi::module]-annotated mod, together with its SourceMap.

Only items carrying a WeaveFFI marker are exported; everything else (private helpers, use items, free functions without #[weaveffi::export]) is ignored, so a module can freely mix exported surface and implementation. Type aliases declared anywhere in the tree are substituted.

§Errors

Returns a spanned error when an annotated item cannot be mapped to the IR (an unsupported type, an enum without #[repr(i32)], a callback interface method that doesn’t return Result<T, weaveffi::ForeignError>, a #[cfg] on a member, an out-of-line submodule, and so on).