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