mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Added conversion functions between DOMString and String.
Implemented From<String> and From<&str> for DOMString, and From<DOMString> for String.
This commit is contained in:
parent
1720595a85
commit
9cbc4393eb
1 changed files with 18 additions and 0 deletions
|
@ -79,6 +79,24 @@ impl<'a> PartialEq<&'a str> for DOMString {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
impl From<String> for DOMString {
|
||||||
|
fn from(contents: String) -> DOMString {
|
||||||
|
DOMString(contents)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl<'a> From<&'a str> for DOMString {
|
||||||
|
fn from(contents: &str) -> DOMString {
|
||||||
|
DOMString::from(String::from(contents))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
impl From<DOMString> for String {
|
||||||
|
fn from(contents: DOMString) -> String {
|
||||||
|
contents.0
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
impl Into<Vec<u8>> for DOMString {
|
impl Into<Vec<u8>> for DOMString {
|
||||||
fn into(self) -> Vec<u8> {
|
fn into(self) -> Vec<u8> {
|
||||||
self.0.into()
|
self.0.into()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue