use std::borrow::Cow;
use crate::{LayerFn, LayerHandlerFn, Path};
#[doc(hidden)]
#[derive(Debug, Clone)]
pub struct ModuleLayerFn {
module_path: &'static str,
render: LayerHandlerFn,
}
impl ModuleLayerFn {
pub const fn new(module_path: &'static str, render: LayerHandlerFn) -> Self {
Self {
module_path,
render,
}
}
#[must_use]
pub fn into_layer(self, path: Cow<'static, Path>) -> LayerFn {
LayerFn::new(path, self.render)
}
#[must_use]
pub fn module_path(&self) -> &'static str {
self.module_path
}
}
#[cfg(feature = "discover")]
inventory::collect!(ModuleLayerFn);