anza 0.5.0

Ultra-lightweight, zero-copy, cryptographically verified Server-Templated UI (STUI) engine
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use {
  super::store::CacheStore,
  crate::{
    engine::file::Template,
    errors::{Error, Result},
  },
};

pub fn get(store: &CacheStore, name: &str) -> Result<Template> {
  let lock = store.templates.read().map_err(|e| Error::internal(e.to_string()))?;
  lock
    .get(name)
    .cloned()
    .ok_or_else(|| Error::not_found(format!("Template '{}' not found in cache", name)))
}