1
0
mirror of https://github.com/rm-dr/servable.git synced 2026-05-16 00:19:01 -07:00
This commit is contained in:
2026-03-22 10:42:49 -07:00
parent 7a13bd0cda
commit 5f1511df9d
4 changed files with 10 additions and 6 deletions
+6
View File
@@ -60,6 +60,12 @@ impl<S: Servable> ServableWithRoute<S> {
pub fn route(&self) -> &str {
&self.route
}
/// Get the route associated with this resource,
/// with the given prefix
pub fn route_at(&self, prefix: &str) -> String {
format!("{prefix}/{}", &*self.route)
}
}
impl<S: Servable> Servable for ServableWithRoute<S> {
+2 -4
View File
@@ -91,8 +91,7 @@ pub struct RenderContext {
}
/// The type of device that requested a page
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
#[derive(Default)]
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
pub enum DeviceType {
/// This is a mobile device, like a phone.
Mobile,
@@ -100,10 +99,9 @@ pub enum DeviceType {
/// This is a device with a large screen
/// and a mouse, like a laptop.
#[default]
Desktop,
Desktop,
}
/// Inferred information about the client
/// that requested a certain route.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]