Eliminate servo_util::atom

We only needed this for Encodable, and now we use JSTraceable instead.
This commit is contained in:
Keegan McAllister 2014-09-29 17:59:47 -07:00
parent 4be0a07585
commit 6429750b33
39 changed files with 77 additions and 74 deletions

View file

@ -19,5 +19,8 @@ path = "../../support/rust-task_info"
[dependencies.string_cache]
git = "https://github.com/servo/string-cache"
[dependencies.string_cache_macros]
git = "https://github.com/servo/string-cache"
[dependencies.url]
git = "https://github.com/servo/rust-url"

View file

@ -1,43 +0,0 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
//! Provides a wrapper around the Atom type in the string cache
//! crate. It's needed so that it can implement the Encodable
//! trait which is required by Servo.
use serialize::{Encoder, Encodable};
use std::fmt;
use std::hash::Hash;
use string_cache::atom;
#[deriving(Clone, Eq, Hash, PartialEq)]
pub struct Atom {
atom: atom::Atom,
}
impl Atom {
#[inline(always)]
pub fn from_slice(slice: &str) -> Atom {
Atom {
atom: atom::Atom::from_slice(slice)
}
}
#[inline(always)]
pub fn as_slice<'t>(&'t self) -> &'t str {
self.atom.as_slice()
}
}
impl fmt::Show for Atom {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{:s}", self.atom.as_slice())
}
}
impl<E, S: Encoder<E>> Encodable<S, E> for Atom {
fn encode(&self, _s: &mut S) -> Result<(), E> {
Ok(())
}
}

View file

@ -29,7 +29,9 @@ extern crate "time" as std_time;
extern crate string_cache;
extern crate url;
pub mod atom;
#[phase(plugin)]
extern crate string_cache_macros;
pub mod bloom;
pub mod cache;
pub mod debug_utils;