use super::Empty;
pub trait Shader<'path>: Sized {
fn default_or_id(self) -> ApplyShader<'path>;
}
#[doc(hidden)]
#[derive(Copy, Clone, Default)]
pub struct ApplyShader<'path> {
pub(crate) path: Option<&'path str>,
}
impl<'path> ApplyShader<'path> {
pub(crate) const fn new(path: &'path str) -> Self {
Self { path: Some(path) }
}
}
impl<'path> Shader<'path> for ApplyShader<'path> {
#[inline]
fn default_or_id(self) -> Self {
self
}
}
impl<'path> Shader<'path> for Empty {
#[inline]
fn default_or_id(self) -> ApplyShader<'path> {
ApplyShader { path: None }
}
}