Skip to content

idea: new syntax #4

Open
Open
@sam0x17

Description

Yandros proposed a new syntax that looks like this:

#[docify::docify]
/// some comments some comments
/// @embed("examples/samples.rs", MyCoolStruct)
/// another example:
/// @embed("src/something.rs", MyThing)
/// some closing comments
pub struct Foo;

Originally mentioned here: paritytech/substrate#14672 (comment)

If we were to go with this syntax, we would finally be able to limit expansion of docify embeds to only be attempted if the caller is #[cfg(doc)] which we currently lack the context information to be able to do, and which is currently impossible in #[doc = ..] position but is possible for an "outer attribute" approach like this.

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions