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
use crate::error::TelescopeError;
use crate::templates::page::Page;
use crate::templates::Template;
use actix_web::HttpRequest;
use futures::future::LocalBoxFuture;
pub mod sponsors;
pub trait StaticPage {
const TEMPLATE_NAME: &'static str;
const PAGE_TITLE: &'static str;
fn template() -> Template {
Template::new(Self::TEMPLATE_NAME)
}
fn page(req: HttpRequest) -> LocalBoxFuture<'static, Result<Page, TelescopeError>> {
Box::pin(async move {
Page::new(&req, Self::PAGE_TITLE, Self::template()).await
})
}
}