use once_cell::sync;
use std::fs;
use std::time;
macro_rules! initialize {
($relative_path:literal, $absolute_path:literal) => {
Asset {
creation_time: sync::Lazy::new(|| {
fs::metadata($absolute_path)
.and_then(|metadata| metadata.created())
.ok()
}),
last_access_time: sync::Lazy::new(|| {
fs::metadata($absolute_path)
.and_then(|metadata| metadata.accessed())
.ok()
}),
last_modification_time: sync::Lazy::new(|| {
fs::metadata($absolute_path)
.and_then(|metadata| metadata.modified())
.ok()
}),
}
};
}
#[iftree::include_file_tree(
"
paths = '/examples/assets/**'
template.initializer = 'initialize'
"
)]
pub struct Asset {
creation_time: sync::Lazy