aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTill Hoeppner2014-11-30 00:58:50 +0000
committerTill Hoeppner2014-11-30 00:58:50 +0000
commit199583a99b1eb5667033b0b082f07220d3c34ef4 (patch)
treee2030b9512916c75d4d6b82b4d03c1b0cfd1a7ef
parent1c47df37c56da0ec30920ac98eb0d15c213ffd4c (diff)
downloadsersve-199583a99b1eb5667033b0b082f07220d3c34ef4.tar.gz
sersve-199583a99b1eb5667033b0b082f07220d3c34ef4.tar.xz
sersve-199583a99b1eb5667033b0b082f07220d3c34ef4.zip
Updates from phone
-rw-r--r--Cargo.lock70
-rw-r--r--src/sersve.rs10
2 files changed, 29 insertions, 51 deletions
diff --git a/Cargo.lock b/Cargo.lock
index 6c16700..6952856 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -3,7 +3,7 @@ name = "sersve"
version = "0.0.1"
dependencies = [
"conduit-mime-types 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "glob 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "glob 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"iron 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
"lazy_static 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"persistent 0.0.1 (git+https://github.com/iron/persistent)",
@@ -20,8 +20,8 @@ name = "cookie"
version = "0.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "openssl 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "time 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "openssl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "time 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -35,25 +35,25 @@ dependencies = [
[[package]]
name = "gcc"
-version = "0.0.2"
+version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "glob"
-version = "0.0.3"
+version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "hyper"
-version = "0.0.5"
+version = "0.0.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"cookie 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
"mime 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "openssl 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "time 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "openssl 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "time 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"typeable 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
- "unsafe-any 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "unsafe-any 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -63,10 +63,10 @@ version = "0.0.5"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"error 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "hyper 0.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
- "modifier 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "hyper 0.0.6 (registry+https://github.com/rust-lang/crates.io-index)",
+ "modifier 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"plugin 0.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "typemap 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "typemap 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
"url 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -76,41 +76,29 @@ version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
-name = "libressl-pnacl-sys"
-version = "2.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "pnacl-build-helper 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
-]
-
-[[package]]
name = "mime"
version = "0.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "modifier"
-version = "0.0.1"
+version = "0.0.3"
source = "registry+https://github.com/rust-lang/crates.io-index"
-dependencies = [
- "stainless 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
-]
[[package]]
name = "openssl"
-version = "0.0.2"
+version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "libressl-pnacl-sys 2.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "openssl-sys 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "openssl-sys 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "openssl-sys"
-version = "0.0.2"
+version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "pkg-config 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
+ "pkg-config 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -129,7 +117,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "pkg-config"
-version = "0.0.1"
+version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
@@ -138,30 +126,20 @@ version = "0.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"phantom 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "typemap 0.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
+ "typemap 0.0.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
-name = "pnacl-build-helper"
-version = "1.0.0"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
name = "rust-mustache"
version = "0.3.0"
source = "git+https://github.com/erickt/rust-mustache#00bfc4fc5914d7f2138d61ecacbbc7b275ea6b98"
[[package]]
-name = "stainless"
-version = "0.0.3"
-source = "registry+https://github.com/rust-lang/crates.io-index"
-
-[[package]]
name = "time"
-version = "0.0.3"
+version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
- "gcc 0.0.2 (registry+https://github.com/rust-lang/crates.io-index)",
+ "gcc 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
@@ -171,16 +149,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
name = "typemap"
-version = "0.0.3"
+version = "0.0.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
dependencies = [
"phantom 0.0.1 (registry+https://github.com/rust-lang/crates.io-index)",
- "unsafe-any 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "unsafe-any 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "unsafe-any"
-version = "0.1.0"
+version = "0.1.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]]
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()));
}