pub struct TemplateRegistry { /* private fields */ }Expand description
Template registry - holds all available dashboard templates
Implementations§
Source§impl TemplateRegistry
impl TemplateRegistry
Sourcepub fn with_built_in_templates(
templates_dir: &Path,
) -> Result<Self, Box<dyn Error>>
pub fn with_built_in_templates( templates_dir: &Path, ) -> Result<Self, Box<dyn Error>>
Create a registry with the single built-in merged dashboard template pre-loaded.
The merged template lives at
src/render_engine/dashboard/templates/dashboard_unified.html and bundles all
eight dashboard modes (Overview, Threads, Async, Task Graph, Variables,
Passports, FFI, Unsafe/Time) into one HTML file with a side-bar mode switcher.
The templates_dir argument is kept for API compatibility but no longer used.
Sourcepub fn set_external_base(&mut self, path: PathBuf)
pub fn set_external_base(&mut self, path: PathBuf)
Set the base directory for external templates
Sourcepub fn load_external_templates(
&mut self,
templetes_dir: &Path,
) -> Result<(), Box<dyn Error>>
pub fn load_external_templates( &mut self, templetes_dir: &Path, ) -> Result<(), Box<dyn Error>>
Load external templates from the templetes/ directory
Scans subdirectories for code.html files and registers them. Each subdirectory becomes a template with the directory name as the ID.
Sourcepub fn templates(&self) -> &HashMap<String, DashboardTemplate>
pub fn templates(&self) -> &HashMap<String, DashboardTemplate>
Get all available templates
Sourcepub fn get_template(&self, id: &str) -> Option<&DashboardTemplate>
pub fn get_template(&self, id: &str) -> Option<&DashboardTemplate>
Get a specific template by ID
Sourcepub fn render(
&self,
template_id: &str,
data: &Value,
) -> Result<String, Box<dyn Error>>
pub fn render( &self, template_id: &str, data: &Value, ) -> Result<String, Box<dyn Error>>
Render a dashboard using the specified template
Sourcepub fn template_ids(&self) -> Vec<String>
pub fn template_ids(&self) -> Vec<String>
List all available template IDs
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for TemplateRegistry
impl !UnwindSafe for TemplateRegistry
impl Freeze for TemplateRegistry
impl Send for TemplateRegistry
impl Sync for TemplateRegistry
impl Unpin for TemplateRegistry
impl UnsafeUnpin for TemplateRegistry
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more