diff options
author | Anthony Ramine <n.oxyde@gmail.com> | 2016-02-24 17:28:24 +0100 |
---|---|---|
committer | Anthony Ramine <n.oxyde@gmail.com> | 2016-02-24 17:52:17 +0100 |
commit | 0adfb080899104d4b51f6de3012ecf0558199b73 (patch) | |
tree | 60a23222f06c60f0f755158617d6256a23a1f5e2 /components/util/str.rs | |
parent | f7fb03518836ba45b0883aaaf3b8d38a6ff5eae1 (diff) | |
download | servo-0adfb080899104d4b51f6de3012ecf0558199b73.tar.gz servo-0adfb080899104d4b51f6de3012ecf0558199b73.zip |
Implement From<DOMString> for Atom
Diffstat (limited to 'components/util/str.rs')
-rw-r--r-- | components/util/str.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/components/util/str.rs b/components/util/str.rs index 2ffde43fedf..9d0869ccced 100644 --- a/components/util/str.rs +++ b/components/util/str.rs @@ -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 |