Auto merge of #9742 - nox:atom-from-string, r=ecoal95

Make use of From<String> for Atom

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.svg" height="40" alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/9742)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2016-02-25 08:39:44 +05:30
commit b3b6f09206
36 changed files with 100 additions and 96 deletions

View file

@ -46,7 +46,7 @@ selectors = {version = "0.5", features = ["heap_size"]}
serde = "0.6"
serde_macros = "0.6"
smallvec = "0.1"
string_cache = {version = "0.2.9", features = ["heap_size"]}
string_cache = {version = "0.2.10", features = ["heap_size"]}
url = {version = "0.5.5", features = ["heap_size", "serde_serialization"]}
uuid = "0.1.17"

View file

@ -11,6 +11,7 @@ use std::fmt;
use std::iter::{Filter, Peekable};
use std::ops::{Deref, DerefMut};
use std::str::{Bytes, CharIndices, FromStr, Split, from_utf8};
use string_cache::Atom;
#[derive(Clone, Debug, Deserialize, Eq, Hash, HeapSizeOf, Ord, PartialEq, PartialOrd, Serialize)]
pub struct DOMString(String);
@ -96,6 +97,12 @@ impl<'a> From<&'a str> for DOMString {
}
}
impl From<DOMString> for Atom {
fn from(contents: DOMString) -> Atom {
Atom::from(contents.0)
}
}
impl From<DOMString> for String {
fn from(contents: DOMString) -> String {
contents.0