Skip to content

Commit

Permalink
Merge branch 'release-v0.7.15' into release
Browse files Browse the repository at this point in the history
  • Loading branch information
sfackler committed May 26, 2016
2 parents ea8dd65 + 20f896e commit 6bbc9e2
Show file tree
Hide file tree
Showing 13 changed files with 76 additions and 44 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ Rust-PHF

[![Build Status](https://travis-ci.org/sfackler/rust-phf.png?branch=master)](https://travis-ci.org/sfackler/rust-phf) [![Latest Version](https://img.shields.io/crates/v/phf.svg)](https://crates.io/crates/phf)

[Documentation](https://sfackler.github.io/rust-phf/doc/v0.7.14/phf)
[Documentation](https://sfackler.github.io/rust-phf/doc/v0.7.15/phf)

Rust-PHF is a library to generate efficient lookup tables at compile time using
[perfect hash functions](http://en.wikipedia.org/wiki/Perfect_hash_function).
Expand Down
6 changes: 3 additions & 3 deletions phf/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
name = "phf"
authors = ["Steven Fackler <sfackler@gmail.com>"]
version = "0.7.14"
version = "0.7.15"
license = "MIT"
description = "Runtime support for perfect hash function data structures"
repository = "https://github.com/sfackler/rust-phf"
documentation = "https://sfackler.github.io/rust-phf/doc/v0.7.14/phf"
documentation = "https://sfackler.github.io/rust-phf/doc/v0.7.15/phf"

[lib]
name = "phf"
Expand All @@ -17,4 +17,4 @@ core = ["phf_shared/core"]
unicase = ["phf_shared/unicase"]

[dependencies]
phf_shared = { version = "=0.7.14", path = "../phf_shared" }
phf_shared = { version = "=0.7.15", path = "../phf_shared" }
2 changes: 1 addition & 1 deletion phf/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
//! PHF data structures can be generated via the syntax extensions in the
//! `phf_macros` crate or via code generation in the `phf_codegen` crate. See
//! the documentation of those crates for more details.
#![doc(html_root_url="https://sfackler.github.io/rust-phf/doc/v0.7.14")]
#![doc(html_root_url="https://sfackler.github.io/rust-phf/doc/v0.7.15")]
#![warn(missing_docs)]
#![cfg_attr(feature = "core", no_std)]

Expand Down
8 changes: 4 additions & 4 deletions phf_builder/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
[package]
name = "phf_builder"
version = "0.7.14"
version = "0.7.15"
authors = ["Steven Fackler <sfackler@gmail.com>"]
license = "MIT"
description = "Runtime creation of perfect hash function data structures"
repository = "https://github.com/sfackler/rust-phf"
documentation = "https://sfackler.github.io/rust-phf/doc/v0.7.14/phf_builder"
documentation = "https://sfackler.github.io/rust-phf/doc/v0.7.15/phf_builder"

[dependencies]
phf = { version = "=0.7.14", path = "../phf" }
phf_generator = { version = "=0.7.14", path = "../phf_generator" }
phf = { version = "=0.7.15", path = "../phf" }
phf_generator = { version = "=0.7.15", path = "../phf_generator" }
4 changes: 2 additions & 2 deletions phf_builder/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![doc(html_root_url="http://sfackler.github.io/rust-phf/doc/v0.7.14")]
#![doc(html_root_url="http://sfackler.github.io/rust-phf/doc/v0.7.15")]
extern crate phf;
extern crate phf_generator;

Expand Down Expand Up @@ -51,7 +51,7 @@ impl<K: Hash + PhfHash + Eq, V> Map<K, V> {
let mut entries = self.keys
.into_iter()
.zip(self.values)
.map(Option::Some)
.map(Some)
.collect::<Vec<_>>();
let entries = state.map
.iter()
Expand Down
8 changes: 4 additions & 4 deletions phf_codegen/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
[package]
name = "phf_codegen"
authors = ["Steven Fackler <sfackler@gmail.com>"]
version = "0.7.14"
version = "0.7.15"
license = "MIT"
description = "Codegen library for PHF types"
repository = "https://github.com/sfackler/rust-phf"
documentation = "https://sfackler.github.io/rust-phf/doc/v0.7.14/phf_codegen"
documentation = "https://sfackler.github.io/rust-phf/doc/v0.7.15/phf_codegen"

[dependencies.phf_generator]
path = "../phf_generator"
version = "=0.7.14"
version = "=0.7.15"

[dependencies.phf_shared]
path = "../phf_shared"
version = "=0.7.14"
version = "=0.7.15"
64 changes: 48 additions & 16 deletions phf_codegen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@
//! builder.entry("world", "2");
//! // ...
//! ```
#![doc(html_root_url="http://sfackler.github.io/rust-phf/doc/v0.7.14")]
#![doc(html_root_url="http://sfackler.github.io/rust-phf/doc/v0.7.15")]
extern crate phf_shared;
extern crate phf_generator;

Expand All @@ -93,6 +93,7 @@ use std::io::prelude::*;
pub struct Map<K> {
keys: Vec<K>,
values: Vec<String>,
path: String,
}

impl<K: Hash+PhfHash+Eq+fmt::Debug> Map<K> {
Expand All @@ -112,15 +113,22 @@ impl<K: Hash+PhfHash+Eq+fmt::Debug> Map<K> {
Map {
keys: vec![],
values: vec![],
path: String::from("::phf"),
}
}

/// Set the path to the `phf` crate from the global namespace
pub fn phf_path(&mut self, path: &str) -> &mut Map<K> {
self.path = path.to_owned();
self
}

/// Adds an entry to the builder.
///
/// `value` will be written exactly as provided in the constructed source.
pub fn entry(&mut self, key: K, value: &str) -> &mut Map<K> {
self.keys.push(key);
self.values.push(value.to_string());
self.values.push(value.to_owned());
self
}

Expand All @@ -140,10 +148,10 @@ impl<K: Hash+PhfHash+Eq+fmt::Debug> Map<K> {
let state = phf_generator::generate_hash(&self.keys);

try!(write!(w,
"::phf::Map {{
"{}::Map {{
key: {},
disps: ::phf::Slice::Static(&[",
state.key));
disps: {}::Slice::Static(&[",
self.path, state.key, self.path));
for &(d1, d2) in &state.disps {
try!(write!(w,
"
Expand All @@ -154,7 +162,7 @@ impl<K: Hash+PhfHash+Eq+fmt::Debug> Map<K> {
try!(write!(w,
"
]),
entries: ::phf::Slice::Static(&["));
entries: {}::Slice::Static(&[", self.path));
for &idx in &state.map {
try!(write!(w,
"
Expand All @@ -177,7 +185,15 @@ pub struct Set<T> {
impl<T: Hash+PhfHash+Eq+fmt::Debug> Set<T> {
/// Constructs a new `phf::Set` builder.
pub fn new() -> Set<T> {
Set { map: Map::new() }
Set {
map: Map::new(),
}
}

/// Set the path to the `phf` crate from the global namespace
pub fn phf_path(&mut self, path: &str) -> &mut Set<T> {
self.map.phf_path(path);
self
}

/// Adds an entry to the builder.
Expand All @@ -192,7 +208,7 @@ impl<T: Hash+PhfHash+Eq+fmt::Debug> Set<T> {
///
/// Panics if there are any duplicate entries.
pub fn build<W: Write>(&self, w: &mut W) -> io::Result<()> {
try!(write!(w, "::phf::Set {{ map: "));
try!(write!(w, "{}::Set {{ map: ", self.map.path));
try!(self.map.build(w));
write!(w, " }}")
}
Expand All @@ -202,6 +218,7 @@ impl<T: Hash+PhfHash+Eq+fmt::Debug> Set<T> {
pub struct OrderedMap<K> {
keys: Vec<K>,
values: Vec<String>,
path: String,
}

impl<K: Hash+PhfHash+Eq+fmt::Debug> OrderedMap<K> {
Expand All @@ -210,15 +227,22 @@ impl<K: Hash+PhfHash+Eq+fmt::Debug> OrderedMap<K> {
OrderedMap {
keys: vec![],
values: vec![],
path: String::from("::phf"),
}
}

/// Set the path to the `phf` crate from the global namespace
pub fn phf_path(&mut self, path: &str) -> &mut OrderedMap<K> {
self.path = path.to_owned();
self
}

/// Adds an entry to the builder.
///
/// `value` will be written exactly as provided in the constructed source.
pub fn entry(&mut self, key: K, value: &str) -> &mut OrderedMap<K> {
self.keys.push(key);
self.values.push(value.to_string());
self.values.push(value.to_owned());
self
}

Expand All @@ -239,10 +263,10 @@ impl<K: Hash+PhfHash+Eq+fmt::Debug> OrderedMap<K> {
let state = phf_generator::generate_hash(&self.keys);

try!(write!(w,
"::phf::OrderedMap {{
"{}::OrderedMap {{
key: {},
disps: ::phf::Slice::Static(&[",
state.key));
disps: {}::Slice::Static(&[",
self.path, state.key, self.path));
for &(d1, d2) in &state.disps {
try!(write!(w,
"
Expand All @@ -253,7 +277,7 @@ impl<K: Hash+PhfHash+Eq+fmt::Debug> OrderedMap<K> {
try!(write!(w,
"
]),
idxs: ::phf::Slice::Static(&["));
idxs: {}::Slice::Static(&[", self.path));
for &idx in &state.map {
try!(write!(w,
"
Expand All @@ -263,7 +287,7 @@ impl<K: Hash+PhfHash+Eq+fmt::Debug> OrderedMap<K> {
try!(write!(w,
"
]),
entries: ::phf::Slice::Static(&["));
entries: {}::Slice::Static(&[", self.path));
for (key, value) in self.keys.iter().zip(self.values.iter()) {
try!(write!(w,
"
Expand All @@ -286,7 +310,15 @@ pub struct OrderedSet<T> {
impl<T: Hash+PhfHash+Eq+fmt::Debug> OrderedSet<T> {
/// Constructs a new `phf::OrderedSet` builder.
pub fn new() -> OrderedSet<T> {
OrderedSet { map: OrderedMap::new() }
OrderedSet {
map: OrderedMap::new(),
}
}

/// Set the path to the `phf` crate from the global namespace
pub fn phf_path(&mut self, path: &str) -> &mut OrderedSet<T> {
self.map.phf_path(path);
self
}

/// Adds an entry to the builder.
Expand All @@ -302,7 +334,7 @@ impl<T: Hash+PhfHash+Eq+fmt::Debug> OrderedSet<T> {
///
/// Panics if there are any duplicate entries.
pub fn build<W: Write>(&self, w: &mut W) -> io::Result<()> {
try!(write!(w, "::phf::OrderedSet {{ map: "));
try!(write!(w, "{}::OrderedSet {{ map: ", self.map.path));
try!(self.map.build(w));
write!(w, " }}")
}
Expand Down
6 changes: 3 additions & 3 deletions phf_generator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
[package]
name = "phf_generator"
authors = ["Steven Fackler <sfackler@gmail.com>"]
version = "0.7.14"
version = "0.7.15"
license = "MIT"
description = "PHF generation logic"
repository = "https://github.com/sfackler/rust-phf"
documentation = "https://sfackler.github.io/rust-phf/doc/v0.7.14/phf_generator"
documentation = "https://sfackler.github.io/rust-phf/doc/v0.7.15/phf_generator"

[dependencies]
rand = "0.3"

[dependencies.phf_shared]
path = "../phf_shared"
version = "=0.7.14"
version = "=0.7.15"
2 changes: 1 addition & 1 deletion phf_generator/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![doc(html_root_url="http://sfackler.github.io/rust-phf/doc/v0.7.14")]
#![doc(html_root_url="http://sfackler.github.io/rust-phf/doc/v0.7.15")]
extern crate phf_shared;
extern crate rand;

Expand Down
10 changes: 5 additions & 5 deletions phf_macros/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
name = "phf_macros"
authors = ["Steven Fackler <sfackler@gmail.com>"]
version = "0.7.14"
version = "0.7.15"
license = "MIT"
description = "Compiler plugin for perfect hash function data structures"
repository = "https://github.com/sfackler/rust-phf"
documentation = "https://sfackler.github.io/rust-phf/doc/v0.7.14/phf_macros"
documentation = "https://sfackler.github.io/rust-phf/doc/v0.7.15/phf_macros"

[lib]
name = "phf_macros"
Expand All @@ -18,16 +18,16 @@ stats = ["time"]

[dependencies.phf_generator]
path = "../phf_generator"
version = "=0.7.14"
version = "=0.7.15"

[dependencies.phf_shared]
path = "../phf_shared"
version = "=0.7.14"
version = "=0.7.15"

[dependencies.time]
version = "0.1"
optional = true

[dev-dependencies.phf]
path = "../phf"
version = "=0.7.14"
version = "=0.7.15"
2 changes: 1 addition & 1 deletion phf_macros/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
//! }
//! # fn main() {}
//! ```
#![doc(html_root_url="http://sfackler.github.io/rust-phf/doc/v0.7.14")]
#![doc(html_root_url="http://sfackler.github.io/rust-phf/doc/v0.7.15")]
#![feature(plugin_registrar, quote, rustc_private)]

extern crate syntax;
Expand Down
4 changes: 2 additions & 2 deletions phf_shared/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
[package]
name = "phf_shared"
authors = ["Steven Fackler <sfackler@gmail.com>"]
version = "0.7.14"
version = "0.7.15"
license = "MIT"
description = "Support code shared by PHF libraries"
repository = "https://github.com/sfackler/rust-phf"
documentation = "https://sfackler.github.io/rust-phf/doc/v0.7.14/phf_shared"
documentation = "https://sfackler.github.io/rust-phf/doc/v0.7.15/phf_shared"

[lib]
name = "phf_shared"
Expand Down
2 changes: 1 addition & 1 deletion phf_shared/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#![doc(html_root_url="http://sfackler.github.io/rust-phf/doc/v0.7.14")]
#![doc(html_root_url="http://sfackler.github.io/rust-phf/doc/v0.7.15")]
#![cfg_attr(feature = "core", no_std)]
#[cfg(not(feature = "core"))]
extern crate std as core;
Expand Down

0 comments on commit 6bbc9e2

Please sign in to comment.