pub trait RustEmbed {
type File: EmbedableFile;
// Required method
fn get(file_path: &str) -> Option<Self::File>;
}
Expand description
A folder of embedded files.
The type of the file RustEmbed::File
depends on whether we’re in debug
mode or release mode:
- In debug mode it will be a
DynamicFile
- In release mode it will be a
EmbeddedFile
The derivation will automatically generate the correct file type. You don’t
need to directly interface with the different file types that might get
returned: you should instead use the EmbedableFile
trait which is
implemented for both.
Required Associated Types§
type File: EmbedableFile
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.