Add Imfs to ServeSession, threading through generic ImfsFetcher

This commit is contained in:
Lucien Greathouse
2019-09-13 12:52:15 -07:00
parent 651e63a0fb
commit 8481caa67c
5 changed files with 37 additions and 29 deletions

View File

@@ -7,6 +7,7 @@ use hyper::{header, service::Service, Body, Method, Request, Response, StatusCod
use ritz::html;
use crate::{
imfs::new::ImfsFetcher,
serve_session::ServeSession,
web::{
interface::{NotFoundError, SERVER_VERSION},
@@ -16,12 +17,12 @@ use crate::{
static HOME_CSS: &str = include_str!("../../assets/index.css");
pub struct UiService {
pub struct UiService<F> {
#[allow(unused)] // TODO: Fill out interface service
serve_session: Arc<ServeSession>,
serve_session: Arc<ServeSession<F>>,
}
impl Service for UiService {
impl<F: ImfsFetcher> Service for UiService<F> {
type ReqBody = Body;
type ResBody = Body;
type Error = hyper::Error;
@@ -39,8 +40,8 @@ impl Service for UiService {
}
}
impl UiService {
pub fn new(serve_session: Arc<ServeSession>) -> UiService {
impl<F: ImfsFetcher> UiService<F> {
pub fn new(serve_session: Arc<ServeSession<F>>) -> Self {
UiService { serve_session }
}