mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
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:
commit
b3b6f09206
36 changed files with 100 additions and 96 deletions
|
@ -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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue