docify icon indicating copy to clipboard operation
docify copied to clipboard

support extern crate

Open gilescope opened this issue 2 years ago • 3 comments

I'm looking at https://github.com/paritytech/polkadot-sdk/issues/2101 but in your_first_pallet I can't see how to add in the alloc statement at the start of the crate. I thought this might work:

#[docify::export]
extern crate alloc;

but seems not. Any thoughts?

gilescope avatar Jan 18 '24 07:01 gilescope

this line essentially governs what items are supported: https://github.com/sam0x17/docify/blob/main/macros/src/lib.rs#L618

So if all of those traits are implemented for ItemExternCrate then it should be supported. If not, would be pretty easy to add support by submitting a PR that impls whatever traits are missing on that item. I don't have much bandwidth for this right now but happy to accept a PR that adds this

sam0x17 avatar Jan 18 '24 08:01 sam0x17

what's weird is it looks like extern crate should be supported: https://github.com/sam0x17/docify/blob/main/macros/src/lib.rs#L173

sam0x17 avatar Jan 18 '24 08:01 sam0x17

actually I would try giving it an explicit name like #[docify::export(some_name)], might be a naming collision

sam0x17 avatar Jan 18 '24 08:01 sam0x17