Move LowercaseString near its only consumer.

This commit is contained in:
Ms2ger 2016-06-05 13:20:53 +02:00
parent 06a1d04ca6
commit c2e8916168
2 changed files with 24 additions and 24 deletions

View file

@ -17,6 +17,7 @@ use platform::font_template::FontTemplateData;
use std::borrow::ToOwned;
use std::collections::HashMap;
use std::mem;
use std::ops::Deref;
use std::sync::{Arc, Mutex};
use std::u32;
use string_cache::Atom;
@ -24,7 +25,6 @@ use style::font_face::Source;
use style::properties::longhands::font_family::computed_value::FontFamily;
use url::Url;
use util::prefs;
use util::str::LowercaseString;
use util::thread::spawn_named;
use webrender_traits;
@ -460,3 +460,26 @@ fn is_supported_font_type(toplevel: &TopLevel, sublevel: &SubLevel) -> bool {
_ => false,
}
}
#[derive(Clone, Eq, PartialEq, Hash, Debug, Deserialize, Serialize)]
pub struct LowercaseString {
inner: String,
}
impl LowercaseString {
pub fn new(s: &str) -> LowercaseString {
LowercaseString {
inner: s.to_lowercase(),
}
}
}
impl Deref for LowercaseString {
type Target = str;
#[inline]
fn deref(&self) -> &str {
&*self.inner
}
}

View file

@ -5,7 +5,6 @@
use num_traits::ToPrimitive;
use std::convert::AsRef;
use std::iter::{Filter, Peekable};
use std::ops::Deref;
use std::str::Split;
pub type StaticCharVec = &'static [char];
@ -117,28 +116,6 @@ pub fn read_exponent<I: Iterator<Item=char>>(mut iter: Peekable<I>) -> Option<i3
}
}
#[derive(Clone, Eq, PartialEq, Hash, Debug, Deserialize, Serialize)]
pub struct LowercaseString {
inner: String,
}
impl LowercaseString {
pub fn new(s: &str) -> LowercaseString {
LowercaseString {
inner: s.to_lowercase(),
}
}
}
impl Deref for LowercaseString {
type Target = str;
#[inline]
fn deref(&self) -> &str {
&*self.inner
}
}
pub fn str_join<I, T>(strs: I, join: &str) -> String
where I: IntoIterator<Item=T>, T: AsRef<str>,
{