mirror of
https://github.com/servo/servo.git
synced 2025-08-02 20:20:14 +01:00
Implement Borrow<str> for DOMString
Useful to use DOMString as a HashMap key type.
This commit is contained in:
parent
dd33be4548
commit
20b131af17
1 changed files with 8 additions and 1 deletions
|
@ -5,7 +5,7 @@
|
|||
//! The `ByteString` struct.
|
||||
|
||||
use std::ascii::AsciiExt;
|
||||
use std::borrow::{ToOwned, Cow};
|
||||
use std::borrow::{Borrow, Cow, ToOwned};
|
||||
use std::fmt;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::ops;
|
||||
|
@ -180,6 +180,13 @@ impl DOMString {
|
|||
}
|
||||
}
|
||||
|
||||
impl Borrow<str> for DOMString {
|
||||
#[inline]
|
||||
fn borrow(&self) -> &str {
|
||||
&self.0
|
||||
}
|
||||
}
|
||||
|
||||
impl Default for DOMString {
|
||||
fn default() -> Self {
|
||||
DOMString(String::new())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue