mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
geckolib: fix geckolib build by implementing display on Atoms.
This commit is contained in:
parent
2d566ef0ef
commit
e015e87697
4 changed files with 15 additions and 3 deletions
|
@ -15,6 +15,7 @@ use gecko_bindings::structs::nsIAtom;
|
|||
use heapsize::HeapSizeOf;
|
||||
use serde::{Deserialize, Deserializer, Serialize, Serializer};
|
||||
use std::borrow::Cow;
|
||||
use std::char;
|
||||
use std::fmt;
|
||||
use std::hash::{Hash, Hasher};
|
||||
use std::marker::PhantomData;
|
||||
|
@ -206,6 +207,15 @@ impl fmt::Debug for Atom {
|
|||
}
|
||||
}
|
||||
|
||||
impl fmt::Display for Atom {
|
||||
fn fmt(&self, w: &mut fmt::Formatter) -> fmt::Result {
|
||||
for c in char::decode_utf16(self.as_slice().iter().cloned()) {
|
||||
try!(write!(w, "{}", c.unwrap_or(char::REPLACEMENT_CHARACTER)))
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
impl<'a> From<&'a str> for Atom {
|
||||
#[inline]
|
||||
fn from(string: &str) -> Atom {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue