Skip to main content

Embed

Derive Macro Embed 

Source
#[derive(Embed)]
{
    // Attributes available to this derive:
    #[embed]
}
Expand description

Derive the Embed trait for unit struct, embedding assets from a folder.

§Usage

Apply #[derive(Embed)] to a unit struct and specify the folder to embed using the #[embed(folder = "...")] attribute.

Optionally, specify the crate path with #[embed(crate = path)]. This is applicable when invoking re-exported derive from a public macro in a different crate.

The name of file to serve as index for directories can be customized using #[embed(index = “…”)], the default is “index.html”.