pub use grouse_macros::{file, manifest};
#[derive(Debug, Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct File {
name: &'static str,
digest: &'static str,
path: &'static str,
bytes: &'static [u8],
mime: &'static str,
#[cfg(feature = "base64")]
base64: &'static str,
}
impl File {
#[inline]
pub const fn name(&self) -> &'static str {
self.name
}
#[inline]
pub const fn digest(&self) -> &'static str {
self.digest
}
#[inline]
pub const fn path(&self) -> &'static str {
self.path
}
#[inline]
pub const fn bytes(&self) -> &'static [u8] {
self.bytes
}
#[inline]
pub const fn mime(&self) -> &'static str {
self.mime
}
#[cfg(feature = "base64")]
#[inline]
pub const fn base64(&self) -> &'static str {
self.base64
}
}
pub trait Manifest {
fn files() -> &'static [File];
fn get(x: &str) -> Option<File>;
}
#[cfg(feature = "macros")]
#[doc(hidden)]
pub mod __macros {
#[inline]
pub const fn file(
name: &'static str,
digest: &'static str,
path: &'static str,
bytes: &'static [u8],
mime: &'static str,
#[cfg(feature = "base64")] base64: &'static str,
) -> crate::File {
crate::File {
name,
digest,
path,
bytes,
mime,
#[cfg(feature = "base64")]
base64,
}
}
}