### Define the RustEmbed Trait Source: https://docs.rs/rust-embed/8.12.0/rust_embed/trait.RustEmbed.html The core trait definition for RustEmbed, requiring implementation of get and iter methods. ```rust pub trait RustEmbed { // Required methods fn get(file_path: &str) -> Option; fn iter() -> impl Iterator> + 'static; } ``` -------------------------------- ### get(file_path: &str) -> Option Source: https://docs.rs/rust-embed/8.12.0/rust_embed/trait.RustEmbed.html Retrieves an embedded file and its associated metadata based on the provided file path. ```APIDOC ## fn get(file_path: &str) -> Option ### Description Retrieves an embedded file and its metadata. If the feature `debug-embed` is enabled or the binary was compiled in release mode, the file information is embedded in the binary and the file data is returned as a `Cow::Borrowed(&'static [u8])`. Otherwise, the information is read from the file system on each call and the file data is returned as a `Cow::Owned(Vec)`. ### Parameters - **file_path** (&str) - Required - The relative path of the file to retrieve. ``` -------------------------------- ### RustEmbed Derive Macro Attributes Source: https://docs.rs/rust-embed/8.12.0/rust_embed/derive.RustEmbed.html Lists the available attributes for the RustEmbed derive macro. ```rust #[derive(RustEmbed)] { // Attributes available to this derive: #[folder] #[prefix] #[include] #[exclude] #[allow_missing] #[metadata_only] #[crate_path] #[compression] } ``` -------------------------------- ### iter() -> impl Iterator> + 'static Source: https://docs.rs/rust-embed/8.12.0/rust_embed/trait.RustEmbed.html Returns an iterator over all file paths contained within the embedded folder. ```APIDOC ## fn iter() -> impl Iterator> + 'static ### Description Iterates over the file paths in the folder. If the feature `debug-embed` is enabled or the binary is compiled in release mode, a static array containing the list of relative file paths is used. Otherwise, the files are listed from the file system on each call. ``` -------------------------------- ### Derive RustEmbed for a Struct Source: https://docs.rs/rust-embed/8.12.0/rust_embed/trait.RustEmbed.html Use the Embed derive macro to associate a folder with a struct for asset embedding. ```rust use rust_embed::Embed; #[derive(Embed)] #[folder = "examples/public/"] struct Asset; fn main() {} ``` -------------------------------- ### EmbeddedFile struct definition Source: https://docs.rs/rust-embed/8.12.0/rust_embed/struct.EmbeddedFile.html The structure definition for an embedded file, containing data and metadata fields. ```rust pub struct EmbeddedFile { pub data: Cow<'static, [u8]>, pub metadata: Metadata, } ``` -------------------------------- ### Filenames Enum Definition Source: https://docs.rs/rust-embed/8.12.0/rust_embed/enum.Filenames.html The definition of the Filenames enum, which wraps an iterator over Cow strings. ```rust pub enum Filenames { Dynamic(Box>>), } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.