aboutsummaryrefslogtreecommitdiffstats
path: root/components/style/gecko_string_cache/namespace.rs
diff options
context:
space:
mode:
Diffstat (limited to 'components/style/gecko_string_cache/namespace.rs')
-rw-r--r--components/style/gecko_string_cache/namespace.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/components/style/gecko_string_cache/namespace.rs b/components/style/gecko_string_cache/namespace.rs
index b2f464db184..a89c1873423 100644
--- a/components/style/gecko_string_cache/namespace.rs
+++ b/components/style/gecko_string_cache/namespace.rs
@@ -3,7 +3,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use gecko_bindings::structs::nsIAtom;
-use std::borrow::Borrow;
+use std::borrow::{Borrow, Cow};
use std::fmt;
use std::ops::Deref;
use string_cache::{Atom, WeakAtom};
@@ -31,6 +31,12 @@ impl Deref for Namespace {
}
}
+impl<'a> From<Cow<'a, str>> for Namespace {
+ fn from(s: Cow<'a, str>) -> Self {
+ Namespace(Atom::from(s))
+ }
+}
+
impl fmt::Display for Namespace {
fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
self.0.fmt(w)