From 690990911ed9911ee2dd3dfd485faa0aae66c0d1 Mon Sep 17 00:00:00 2001 From: boasting-squirrel Date: Tue, 12 Feb 2019 20:25:44 +0100 Subject: Reorganized some imports + removed unused imports --- src/listing.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'src/listing.rs') diff --git a/src/listing.rs b/src/listing.rs index 142018a..7a13e9b 100644 --- a/src/listing.rs +++ b/src/listing.rs @@ -8,6 +8,8 @@ use std::io; use std::path::Path; use std::str::FromStr; +use crate::config; + #[derive(Clone, Debug)] pub enum SortingMethods { Natural, @@ -67,6 +69,11 @@ impl FromStr for SortingMethods { } } +pub fn file_handler(req: &HttpRequest) -> Result { + let path = &req.state().path; + Ok(fs::NamedFile::open(path)?) +} + // ↓ Adapted from https://docs.rs/actix-web/0.7.13/src/actix_web/fs.rs.html#564 pub fn directory_listing( dir: &fs::Directory, -- cgit v1.2.3