This commit is contained in:
Stefan Schwarz 2020-08-15 09:10:47 +02:00
parent 7100621f5e
commit 09a3f096c7
8 changed files with 154 additions and 115 deletions

View file

@ -3,26 +3,13 @@ use askama::Template;
#[derive(Template, Default)]
#[template(path = "index.html")]
pub struct IndexTemplate<'a> {
devices: Vec<Device<'a>>,
pub struct IndexTemplate {
my: Vec<db::Entry>,
unassinged: Vec<db::AliveDevice>,
}
pub struct Device<'a> {
pub macaddr: &'a str,
pub nickname: &'a str,
pub descr: &'a str,
pub privacy: PrivacyLevel,
}
#[repr(u8)]
pub enum PrivacyLevel {
Public = 1,
Private = 2,
Internal = 3,
}
impl<'a> IndexTemplate<'a> {
pub fn new() -> Self {
Self::default()
impl IndexTemplate {
pub fn new(my: Vec<db::Entry>, unassinged: Vec<db::AliveDevice>) -> Self {
Self { my, unassinged }
}
}