pub struct EmbeddedSource<R> {
pub entries: &'static [(&'static str, &'static str)],
pub source_path: &'static str,
/* private fields */
}Expand description
Embedded resource source with optional debug hot-reload.
This type holds:
- Embedded entries (name, content) pairs baked in at compile time
- The source path for debug hot-reload
The type parameter R is a marker indicating the resource type
(templates or stylesheets).
Fields§
§entries: &'static [(&'static str, &'static str)]The embedded entries as (name_with_extension, content) pairs.
This is 'static because it’s baked into the binary at compile time.
source_path: &'static strThe source path used for embedding. In debug mode, if this path exists, files are read from disk instead.
Implementations§
Source§impl<R> EmbeddedSource<R>
impl<R> EmbeddedSource<R>
Sourcepub fn source_path(&self) -> &'static str
pub fn source_path(&self) -> &'static str
Returns the source path.
Sourcepub fn should_hot_reload(&self) -> bool
pub fn should_hot_reload(&self) -> bool
Returns true if hot-reload should be used.
Hot-reload is enabled when:
- We’re in debug mode (
debug_assertionsenabled) - The source path exists on disk
Trait Implementations§
Source§impl<R: Clone> Clone for EmbeddedSource<R>
impl<R: Clone> Clone for EmbeddedSource<R>
Source§fn clone(&self) -> EmbeddedSource<R>
fn clone(&self) -> EmbeddedSource<R>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<R: Debug> Debug for EmbeddedSource<R>
impl<R: Debug> Debug for EmbeddedSource<R>
Source§impl From<EmbeddedSource<StylesheetResource>> for StylesheetRegistry
impl From<EmbeddedSource<StylesheetResource>> for StylesheetRegistry
Source§fn from(source: EmbeddedStyles) -> Self
fn from(source: EmbeddedStyles) -> Self
Converts embedded styles into a StylesheetRegistry.
In debug mode, if the source path exists, styles are loaded from disk (enabling hot-reload). Otherwise, embedded content is used.
§Panics
Panics if embedded YAML content fails to parse (should be caught in dev).
Source§impl From<EmbeddedSource<TemplateResource>> for TemplateRegistry
impl From<EmbeddedSource<TemplateResource>> for TemplateRegistry
Source§fn from(source: EmbeddedTemplates) -> Self
fn from(source: EmbeddedTemplates) -> Self
Converts embedded templates into a TemplateRegistry.
In debug mode, if the source path exists, templates are loaded from disk (enabling hot-reload). Otherwise, embedded content is used.