aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorTill Hoeppner2014-11-30 00:58:50 +0000
committerTill Hoeppner2014-11-30 00:58:50 +0000
commit199583a99b1eb5667033b0b082f07220d3c34ef4 (patch)
treee2030b9512916c75d4d6b82b4d03c1b0cfd1a7ef /src
parent1c47df37c56da0ec30920ac98eb0d15c213ffd4c (diff)
downloadsersve-199583a99b1eb5667033b0b082f07220d3c34ef4.tar.gz
sersve-199583a99b1eb5667033b0b082f07220d3c34ef4.tar.xz
sersve-199583a99b1eb5667033b0b082f07220d3c34ef4.zip
Updates from phone
Diffstat (limited to 'src')
-rw-r--r--src/sersve.rs10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/sersve.rs b/src/sersve.rs
index da8ffe2..3973632 100644
--- a/src/sersve.rs
+++ b/src/sersve.rs
@@ -39,7 +39,7 @@ use iron::typemap::Assoc;
use persistent::Read;
-use mustache::{ Template, MapBuilder };
+use mustache::{ Template, VecBuilder, MapBuilder };
pub mod constants;
@@ -92,8 +92,8 @@ fn size_with_unit(mut size: u64) -> String {
fn render(template: Template, root: Path, dir: Path, files: Vec<Path>, filter: Option<Regex>) -> String {
let data = MapBuilder::new()
- .insert_str(KEY_TITLE, dir.display().as_maybe_owned())
- .insert_vec(KEY_CONTENT, |mut vec| {
+ .insert_str(KEY_TITLE, dir.display().as_cow().into_owned())
+ .insert_vec(KEY_CONTENT, |mut vec: VecBuilder| {
let item = |map: MapBuilder, url: &Path, size: u64, name: String| {
map.insert(KEY_URL, &format!("{}", url.display())[]).unwrap()
.insert(KEY_SIZE, &size_with_unit(size)[]).unwrap()
@@ -102,13 +102,13 @@ fn render(template: Template, root: Path, dir: Path, files: Vec<Path>, filter: O
let mut up = dir.clone();
up.pop();
if root.is_ancestor_of(&up) {
- vec = vec.push_map(|map| item(map, &up.path_relative_from(&root).unwrap(), 0, "..".into_string()));
+ vec = vec.push_map(|map: MapBuilder| item(map, &up.path_relative_from(&root).unwrap(), 0, "..".into_string()));
}
for file in files.iter() {
let relative = file.path_relative_from(&root).unwrap();
let stat = file.stat().unwrap();
- let filename = file.filename_display().as_maybe_owned().into_string();
+ let filename = file.filename_display().as_cow().into_owned();
if filter.as_ref().map_or(true, |f| f.is_match(filename[])) {
vec = vec.push_map(|map| item(map, &relative, stat.size, filename.clone()));
}