Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ rust:
- stable
os:
- linux
- osx
script:
- cargo build
- cargo test
Expand Down
7 changes: 2 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]

name = "string_cache"
version = "0.3.0" # Also update README.md when making a semver-breaking change
version = "0.4.0" # Also update README.md when making a semver-breaking change
authors = [ "The Servo Project Developers" ]
description = "A string interning library for Rust, developed as part of the Servo project."
license = "MIT / Apache-2.0"
Expand All @@ -27,12 +27,9 @@ log-events = ["rustc-serialize"]
# Use unstable features to optimize space and time (memory and CPU usage).
unstable = []

# HeapSizeOf support
heap_size = ["heapsize"]

[dependencies]
lazy_static = "0.2"
serde = "0.8"
serde = "0.9"
phf_shared = "0.7.4"
debug_unreachable = "0.1.1"
rustc-serialize = { version = "0.3", optional = true }
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ In `Cargo.toml`:

```toml
[dependencies]
string_cache = "0.3"
string_cache = "0.4"
```

In `lib.rs`:
Expand All @@ -31,7 +31,7 @@ In `Cargo.toml`:
build = "build.rs"

[dependencies]
string_cache = "0.3"
string_cache = "0.4"

[build-dependencies]
string_cache_codegen = "0.3"
Expand Down
11 changes: 3 additions & 8 deletions src/atom.rs
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,6 @@ impl<Static: StaticAtomSet> Atom<Static> {
pub fn get_hash(&self) -> u32 {
((self.unsafe_data >> 32) ^ self.unsafe_data) as u32
}

pub fn with_str<F, Output>(&self, cb: F) -> Output
where F: FnOnce(&str) -> Output {
cb(self)
}
}

impl<Static: StaticAtomSet> Default for Atom<Static> {
Expand Down Expand Up @@ -431,16 +426,16 @@ impl<Static: StaticAtomSet> AsRef<str> for Atom<Static> {
}

impl<Static: StaticAtomSet> Serialize for Atom<Static> {
fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> where S: Serializer {
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error> where S: Serializer {
let string: &str = self.as_ref();
string.serialize(serializer)
}
}

impl<Static: StaticAtomSet> Deserialize for Atom<Static> {
fn deserialize<D>(deserializer: &mut D) -> Result<Self, D::Error> where D: Deserializer {
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error> where D: Deserializer {
let string: String = try!(Deserialize::deserialize(deserializer));
Ok(Atom::from(&*string))
Ok(Atom::from(string))
}
}

Expand Down
2 changes: 1 addition & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

#[cfg(all(test, feature = "unstable"))] extern crate test;
#[cfg(feature = "log-events")] extern crate rustc_serialize;
#[cfg(feature = "heapsize")] #[macro_use] extern crate heapsize;
#[cfg(feature = "heapsize")] extern crate heapsize;
#[cfg(test)] extern crate rand;
#[macro_use] extern crate lazy_static;
#[macro_use] extern crate debug_unreachable;
Expand Down