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
Generated
+1 -1
View File
@@ -1274,7 +1274,7 @@ dependencies = [
[[package]] [[package]]
name = "servable" name = "servable"
version = "0.0.5" version = "0.0.6"
dependencies = [ dependencies = [
"axum", "axum",
"chrono", "chrono",
+1 -1
View File
@@ -5,7 +5,7 @@ resolver = "2"
[workspace.package] [workspace.package]
rust-version = "1.90.0" rust-version = "1.90.0"
edition = "2024" edition = "2024"
version = "0.0.5" version = "0.0.6"
license = "GPL-3.0" license = "GPL-3.0"
repository = "https://github.com/rm-dr/servable" repository = "https://github.com/rm-dr/servable"
readme = "README.md" readme = "README.md"
+6
View File
@@ -60,6 +60,12 @@ impl<S: Servable> ServableWithRoute<S> {
pub fn route(&self) -> &str { pub fn route(&self) -> &str {
&self.route &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> { 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 /// The type of device that requested a page
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Default)]
#[derive(Default)]
pub enum DeviceType { pub enum DeviceType {
/// This is a mobile device, like a phone. /// This is a mobile device, like a phone.
Mobile, Mobile,
@@ -100,10 +99,9 @@ pub enum DeviceType {
/// This is a device with a large screen /// This is a device with a large screen
/// and a mouse, like a laptop. /// and a mouse, like a laptop.
#[default] #[default]
Desktop, Desktop,
} }
/// Inferred information about the client /// Inferred information about the client
/// that requested a certain route. /// that requested a certain route.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)] #[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]