1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84


use crate::hss;


use ::std::{
		
		fmt,
		
		ops::Deref as _,
		
	};


use crate::{
		
		hss::ServerResult,
		hss::Extensions,
		hss::ContentType,
		hss::HandlerDynArc,
		
	};




pub trait StaticResource
		where Self : Sized
{
	fn content_type (&self) -> ContentType;
	fn description (&self) -> &'static str;
	fn into_handler_dyn (self) -> HandlerDynArc;
}


pub trait StaticRoute
		where Self : Sized
{
	fn into_route (self) -> hss::Route;
}


pub trait StaticRoutes
		where Self : Sized
{
	fn into_routes (self) -> hss::Routes;
}




pub struct StaticRouteDebug {
	pub debug : Box<dyn fmt::Debug + Send + Sync>,
}


impl StaticRouteDebug {
	
	pub fn new (_debug : impl fmt::Debug + Send + Sync + 'static) -> Self {
		Self {
				debug : Box::new (_debug),
			}
	}
	
	pub fn from_str_static (_description : &'static str) -> Self {
		struct Description (&'static str);
		impl fmt::Debug for Description {
			fn fmt (&self, _formatter : &mut fmt::Formatter<'_>) -> Result<(), fmt::Error> {
				_formatter.write_str (self.0)
			}
		}
		let _description = Description (_description);
		Self::new (_description)
	}
}


impl fmt::Debug for StaticRouteDebug {
	
	fn fmt (&self, _formatter : &mut fmt::Formatter) -> Result<(), fmt::Error> {
		self.debug.deref () .fmt (_formatter)
	}
}