зеркало из https://github.com/mozilla/gecko-dev.git
No bug - Revendor rust dependencies on a CLOSED TREE. r=bustage
MozReview-Commit-ID: 3xbP1u17UTn --HG-- rename : third_party/rust/smallvec/.cargo-checksum.json => third_party/rust/smallvec-0.4.3/.cargo-checksum.json rename : third_party/rust/smallvec/Cargo.toml => third_party/rust/smallvec-0.4.3/Cargo.toml rename : third_party/rust/smallvec/README.md => third_party/rust/smallvec-0.4.3/README.md rename : third_party/rust/smallvec/lib.rs => third_party/rust/smallvec-0.4.3/lib.rs
This commit is contained in:
Родитель
e1034ae8d0
Коммит
09688ccbd8
|
@ -1 +1 @@
|
|||
{"files":{".travis.yml":"f1fb4b65964c81bc1240544267ea334f554ca38ae7a74d57066f4d47d2b5d568","Cargo.toml":"fac23b751b4a88d7102e488a4417d695099287c6c88541e64f11dd8bb52d710f","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"c5781e673335f37ed3d7acb119f8ed33efdf6eb75a7094b7da2abe0c3230adb8","build.rs":"950bcc47a196f07f99f59637c28cc65e02a885130011f90a2b2608248b4724a2","build/match_byte.rs":"2c84b8ca5884347d2007f49aecbd85b4c7582085526e2704399817249996e19b","docs/.nojekyll":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","docs/404.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","docs/index.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","src/color.rs":"c92cdb9dcabcc63de005478ca770858b330f02ee712f9fd21b31eeb7472df72d","src/cow_rc_str.rs":"541216f8ef74ee3cc5cbbc1347e5f32ed66588c401851c9a7d68b867aede1de0","src/from_bytes.rs":"331fe63af2123ae3675b61928a69461b5ac77799fff3ce9978c55cf2c558f4ff","src/lib.rs":"a0433a3cf2147e09a8b2471f50ca136d3494d7fc764417b43dc146e2dd5a09ff","src/macros.rs":"adb9773c157890381556ea83d7942dcc676f99eea71abbb6afeffee1e3f28960","src/nth.rs":"0450aa21ecc4639cbe350a143598d570ed9d2b03ac21b9cb795577e0f92f3be6","src/parser.rs":"3533ece7309e694eccf4858435ad090fc6bf98123d443691572931c4323f44d4","src/rules_and_declarations.rs":"eda11baa27c80df932e43460ec6864ff8c3367aaf7673c15410443097efe2506","src/serializer.rs":"3dc1d9441c9602f26d34c0b209f6d3954814815b780c068f9dc3514d808de3d9","src/size_of_tests.rs":"ccbbd8601646798f87b57877135346bc270736560d2c85b5e5ae8cd6492efd65","src/tests.rs":"e8c2593ee6e93e10fd2bb6a9b8b872d280577ba132c04a533f76c58c7233bf70","src/tokenizer.rs":"c46d540cf589de8a2a2a0d918575a257de4d6a55af78e87b0d9c1345032b80ef","src/unicode_range.rs":"c1c4ed2493e09d248c526ce1ef8575a5f8258da3962b64ffc814ef3bdf9780d0"},"package":"44313341610282488e1156ad1fedebca51c54766c87a041d0287b10499c04ba1"}
|
||||
{"files":{".travis.yml":"f1fb4b65964c81bc1240544267ea334f554ca38ae7a74d57066f4d47d2b5d568","Cargo.toml":"7807f16d417eb1a6ede56cd4ba2da6c5c63e4530289b3f0848f4b154e18eba02","LICENSE":"fab3dd6bdab226f1c08630b1dd917e11fcb4ec5e1e020e2c16f83a0a13863e85","README.md":"c5781e673335f37ed3d7acb119f8ed33efdf6eb75a7094b7da2abe0c3230adb8","build.rs":"b29fc57747f79914d1c2fb541e2bb15a003028bb62751dcb901081ccc174b119","build/match_byte.rs":"2c84b8ca5884347d2007f49aecbd85b4c7582085526e2704399817249996e19b","docs/.nojekyll":"e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855","docs/404.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","docs/index.html":"025861f76f8d1f6d67c20ab624c6e418f4f824385e2dd8ad8732c4ea563c6a2e","src/color.rs":"c60f1b0ab7a2a6213e434604ee33f78e7ef74347f325d86d0b9192d8225ae1cc","src/cow_rc_str.rs":"541216f8ef74ee3cc5cbbc1347e5f32ed66588c401851c9a7d68b867aede1de0","src/from_bytes.rs":"331fe63af2123ae3675b61928a69461b5ac77799fff3ce9978c55cf2c558f4ff","src/lib.rs":"46c377e0c9a75780d5cb0bcf4dfb960f0fb2a996a13e7349bb111b9082252233","src/macros.rs":"adb9773c157890381556ea83d7942dcc676f99eea71abbb6afeffee1e3f28960","src/nth.rs":"5c70fb542d1376cddab69922eeb4c05e4fcf8f413f27563a2af50f72a47c8f8c","src/parser.rs":"9ed4aec998221eb2d2ba99db2f9f82a02399fb0c3b8500627f68f5aab872adde","src/rules_and_declarations.rs":"be2c4f3f3bb673d866575b6cb6084f1879dff07356d583ca9a3595f63b7f916f","src/serializer.rs":"4ccfc9b4fe994aab3803662bbf31cc25052a6a39531073a867b14b224afe42dd","src/size_of_tests.rs":"e5f63c8c18721cc3ff7a5407e84f9889ffa10e66da96e8510a696c3e00ad72d5","src/tests.rs":"80b02c80ab0fd580dad9206615c918e0db7dff63dfed0feeedb66f317d24b24b","src/tokenizer.rs":"429b2cba419cf8b923fbcc32d3bd34c0b39284ebfcb9fc29b8eb8643d8d5f312","src/unicode_range.rs":"c1c4ed2493e09d248c526ce1ef8575a5f8258da3962b64ffc814ef3bdf9780d0"},"package":"8a807ac3ab7a217829c2a3b65732b926b2befe6a35f33b4bf8b503692430f223"}
|
|
@ -12,7 +12,7 @@
|
|||
|
||||
[package]
|
||||
name = "cssparser"
|
||||
version = "0.22.0"
|
||||
version = "0.23.2"
|
||||
authors = ["Simon Sapin <simon.sapin@exyr.org>"]
|
||||
build = "build.rs"
|
||||
exclude = ["src/css-parsing-tests/**", "src/big-data-url.css"]
|
||||
|
@ -22,48 +22,48 @@ readme = "README.md"
|
|||
keywords = ["css", "syntax", "parser"]
|
||||
license = "MPL-2.0"
|
||||
repository = "https://github.com/servo/rust-cssparser"
|
||||
[dependencies.itoa]
|
||||
version = "0.3"
|
||||
|
||||
[dependencies.serde]
|
||||
version = "1.0"
|
||||
optional = true
|
||||
|
||||
[dependencies.procedural-masquerade]
|
||||
version = "0.1"
|
||||
|
||||
[dependencies.matches]
|
||||
version = "0.1"
|
||||
|
||||
[dependencies.heapsize]
|
||||
version = ">= 0.3, < 0.5"
|
||||
optional = true
|
||||
|
||||
[dependencies.smallvec]
|
||||
version = "0.4.3"
|
||||
|
||||
[dependencies.phf]
|
||||
version = "0.7"
|
||||
|
||||
[dependencies.cssparser-macros]
|
||||
version = "0.3"
|
||||
|
||||
[dependencies.dtoa-short]
|
||||
version = "0.3"
|
||||
[dev-dependencies.rustc-serialize]
|
||||
|
||||
[dependencies.heapsize]
|
||||
version = ">= 0.3, < 0.5"
|
||||
optional = true
|
||||
|
||||
[dependencies.itoa]
|
||||
version = "0.3"
|
||||
|
||||
[dependencies.matches]
|
||||
version = "0.1"
|
||||
|
||||
[dependencies.phf]
|
||||
version = "0.7"
|
||||
|
||||
[dependencies.procedural-masquerade]
|
||||
version = "0.1"
|
||||
|
||||
[dependencies.serde]
|
||||
version = "1.0"
|
||||
optional = true
|
||||
|
||||
[dependencies.smallvec]
|
||||
version = "0.6"
|
||||
[dev-dependencies.difference]
|
||||
version = "1.0"
|
||||
|
||||
[dev-dependencies.encoding_rs]
|
||||
version = "0.7"
|
||||
[build-dependencies.syn]
|
||||
version = "0.11"
|
||||
|
||||
[dev-dependencies.rustc-serialize]
|
||||
version = "0.3"
|
||||
[build-dependencies.quote]
|
||||
version = "0.3"
|
||||
|
||||
[build-dependencies.syn]
|
||||
version = "0.11"
|
||||
|
||||
[features]
|
||||
dummy_match_byte = []
|
||||
bench = []
|
||||
dummy_match_byte = []
|
||||
|
|
|
@ -33,6 +33,11 @@ mod codegen {
|
|||
}
|
||||
|
||||
fn main() {
|
||||
if std::mem::size_of::<Option<bool>>() == 1 {
|
||||
// https://github.com/rust-lang/rust/pull/45225
|
||||
println!("cargo:rustc-cfg=rustc_has_pr45225")
|
||||
}
|
||||
|
||||
let manifest_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
||||
let tokenizer_rs = Path::new(&manifest_dir).join("src/tokenizer.rs");
|
||||
codegen::main(&tokenizer_rs);
|
||||
|
|
|
@ -144,11 +144,134 @@ impl ToCss for Color {
|
|||
}
|
||||
}
|
||||
|
||||
/// Either a number or a percentage.
|
||||
pub enum NumberOrPercentage {
|
||||
/// `<number>`.
|
||||
Number {
|
||||
/// The numeric value parsed, as a float.
|
||||
value: f32,
|
||||
},
|
||||
/// `<percentage>`
|
||||
Percentage {
|
||||
/// The value as a float, divided by 100 so that the nominal range is
|
||||
/// 0.0 to 1.0.
|
||||
unit_value: f32,
|
||||
},
|
||||
}
|
||||
|
||||
impl NumberOrPercentage {
|
||||
fn unit_value(&self) -> f32 {
|
||||
match *self {
|
||||
NumberOrPercentage::Number { value } => value,
|
||||
NumberOrPercentage::Percentage { unit_value } => unit_value,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// Either an angle or a number.
|
||||
pub enum AngleOrNumber {
|
||||
/// `<number>`.
|
||||
Number {
|
||||
/// The numeric value parsed, as a float.
|
||||
value: f32,
|
||||
},
|
||||
/// `<angle>`
|
||||
Angle {
|
||||
/// The value as a number of degrees.
|
||||
degrees: f32,
|
||||
},
|
||||
}
|
||||
|
||||
impl AngleOrNumber {
|
||||
fn degrees(&self) -> f32 {
|
||||
match *self {
|
||||
AngleOrNumber::Number { value } => value,
|
||||
AngleOrNumber::Angle { degrees } => degrees,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// A trait that can be used to hook into how `cssparser` parses color
|
||||
/// components, with the intention of implementing more complicated behavior.
|
||||
///
|
||||
/// For example, this is used by Servo to support calc() in color.
|
||||
pub trait ColorComponentParser<'i> {
|
||||
/// A custom error type that can be returned from the parsing functions.
|
||||
type Error: 'i;
|
||||
|
||||
/// Parse an `<angle>` or `<number>`.
|
||||
///
|
||||
/// Returns the result in degrees.
|
||||
fn parse_angle_or_number<'t>(
|
||||
&self,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<AngleOrNumber, ParseError<'i, Self::Error>> {
|
||||
let location = input.current_source_location();
|
||||
Ok(match *input.next()? {
|
||||
Token::Number { value, .. } => AngleOrNumber::Number { value },
|
||||
Token::Dimension { value: v, ref unit, .. } => {
|
||||
let degrees = match_ignore_ascii_case! { &*unit,
|
||||
"deg" => v,
|
||||
"grad" => v * 360. / 400.,
|
||||
"rad" => v * 360. / (2. * PI),
|
||||
"turn" => v * 360.,
|
||||
_ => return Err(location.new_unexpected_token_error(Token::Ident(unit.clone()))),
|
||||
};
|
||||
|
||||
AngleOrNumber::Angle { degrees }
|
||||
}
|
||||
ref t => return Err(location.new_unexpected_token_error(t.clone()))
|
||||
})
|
||||
}
|
||||
|
||||
/// Parse a `<percentage>` value.
|
||||
///
|
||||
/// Returns the result in a number from 0.0 to 1.0.
|
||||
fn parse_percentage<'t>(
|
||||
&self,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<f32, ParseError<'i, Self::Error>> {
|
||||
input.expect_percentage().map_err(From::from)
|
||||
}
|
||||
|
||||
/// Parse a `<number>` value.
|
||||
fn parse_number<'t>(
|
||||
&self,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<f32, ParseError<'i, Self::Error>> {
|
||||
input.expect_number().map_err(From::from)
|
||||
}
|
||||
|
||||
/// Parse a `<number>` value or a `<percentage>` value.
|
||||
fn parse_number_or_percentage<'t>(
|
||||
&self,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<NumberOrPercentage, ParseError<'i, Self::Error>> {
|
||||
let location = input.current_source_location();
|
||||
Ok(match *input.next()? {
|
||||
Token::Number { value, .. } => NumberOrPercentage::Number { value },
|
||||
Token::Percentage { unit_value, .. } => NumberOrPercentage::Percentage { unit_value },
|
||||
ref t => return Err(location.new_unexpected_token_error(t.clone()))
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
struct DefaultComponentParser;
|
||||
impl<'i> ColorComponentParser<'i> for DefaultComponentParser {
|
||||
type Error = ();
|
||||
}
|
||||
|
||||
impl Color {
|
||||
/// Parse a <color> value, per CSS Color Module Level 3.
|
||||
///
|
||||
/// FIXME(#2) Deprecated CSS2 System Colors are not supported yet.
|
||||
pub fn parse<'i, 't>(input: &mut Parser<'i, 't>) -> Result<Color, BasicParseError<'i>> {
|
||||
pub fn parse_with<'i, 't, ComponentParser>(
|
||||
component_parser: &ComponentParser,
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Color, ParseError<'i, ComponentParser::Error>>
|
||||
where
|
||||
ComponentParser: ColorComponentParser<'i>,
|
||||
{
|
||||
// FIXME: remove clone() when lifetimes are non-lexical
|
||||
let location = input.current_source_location();
|
||||
let token = input.next()?.clone();
|
||||
|
@ -159,11 +282,19 @@ impl Color {
|
|||
Token::Ident(ref value) => parse_color_keyword(&*value),
|
||||
Token::Function(ref name) => {
|
||||
return input.parse_nested_block(|arguments| {
|
||||
parse_color_function(&*name, arguments).map_err(|e| e.into())
|
||||
}).map_err(ParseError::<()>::basic);
|
||||
parse_color_function(component_parser, &*name, arguments)
|
||||
})
|
||||
}
|
||||
_ => Err(())
|
||||
}.map_err(|()| location.new_basic_unexpected_token_error(token))
|
||||
}.map_err(|()| location.new_unexpected_token_error(token))
|
||||
}
|
||||
|
||||
/// Parse a <color> value, per CSS Color Module Level 3.
|
||||
pub fn parse<'i, 't>(
|
||||
input: &mut Parser<'i, 't>,
|
||||
) -> Result<Color, BasicParseError<'i>> {
|
||||
let component_parser = DefaultComponentParser;
|
||||
Self::parse_with(&component_parser, input).map_err(ParseError::basic)
|
||||
}
|
||||
|
||||
/// Parse a color hash, without the leading '#' character.
|
||||
|
@ -195,10 +326,8 @@ impl Color {
|
|||
_ => Err(())
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
#[inline]
|
||||
fn rgb(red: u8, green: u8, blue: u8) -> Color {
|
||||
rgba(red, green, blue, 255)
|
||||
|
@ -420,11 +549,18 @@ fn clamp_floor_256_f32(val: f32) -> u8 {
|
|||
}
|
||||
|
||||
#[inline]
|
||||
fn parse_color_function<'i, 't>(name: &str, arguments: &mut Parser<'i, 't>) -> Result<Color, BasicParseError<'i>> {
|
||||
fn parse_color_function<'i, 't, ComponentParser>(
|
||||
component_parser: &ComponentParser,
|
||||
name: &str,
|
||||
arguments: &mut Parser<'i, 't>
|
||||
) -> Result<Color, ParseError<'i, ComponentParser::Error>>
|
||||
where
|
||||
ComponentParser: ColorComponentParser<'i>,
|
||||
{
|
||||
let (red, green, blue, uses_commas) = match_ignore_ascii_case! { name,
|
||||
"rgb" | "rgba" => parse_rgb_components_rgb(arguments)?,
|
||||
"hsl" | "hsla" => parse_rgb_components_hsl(arguments)?,
|
||||
_ => return Err(arguments.new_basic_unexpected_token_error(Token::Ident(name.to_owned().into()))),
|
||||
"rgb" | "rgba" => parse_rgb_components_rgb(component_parser, arguments)?,
|
||||
"hsl" | "hsla" => parse_rgb_components_hsl(component_parser, arguments)?,
|
||||
_ => return Err(arguments.new_unexpected_token_error(Token::Ident(name.to_owned().into()))),
|
||||
};
|
||||
|
||||
let alpha = if !arguments.is_exhausted() {
|
||||
|
@ -433,18 +569,7 @@ fn parse_color_function<'i, 't>(name: &str, arguments: &mut Parser<'i, 't>) -> R
|
|||
} else {
|
||||
arguments.expect_delim('/')?;
|
||||
};
|
||||
let location = arguments.current_source_location();
|
||||
match *arguments.next()? {
|
||||
Token::Number { value: v, .. } => {
|
||||
clamp_unit_f32(v)
|
||||
}
|
||||
Token::Percentage { unit_value: v, .. } => {
|
||||
clamp_unit_f32(v)
|
||||
}
|
||||
ref t => {
|
||||
return Err(location.new_basic_unexpected_token_error(t.clone()))
|
||||
}
|
||||
}
|
||||
clamp_unit_f32(component_parser.parse_number_or_percentage(arguments)?.unit_value())
|
||||
} else {
|
||||
255
|
||||
};
|
||||
|
@ -455,93 +580,73 @@ fn parse_color_function<'i, 't>(name: &str, arguments: &mut Parser<'i, 't>) -> R
|
|||
|
||||
|
||||
#[inline]
|
||||
fn parse_rgb_components_rgb<'i, 't>(arguments: &mut Parser<'i, 't>) -> Result<(u8, u8, u8, bool), BasicParseError<'i>> {
|
||||
let red: u8;
|
||||
let green: u8;
|
||||
let blue: u8;
|
||||
let mut uses_commas = false;
|
||||
|
||||
fn parse_rgb_components_rgb<'i, 't, ComponentParser>(
|
||||
component_parser: &ComponentParser,
|
||||
arguments: &mut Parser<'i, 't>
|
||||
) -> Result<(u8, u8, u8, bool), ParseError<'i, ComponentParser::Error>>
|
||||
where
|
||||
ComponentParser: ColorComponentParser<'i>,
|
||||
{
|
||||
// Either integers or percentages, but all the same type.
|
||||
// https://drafts.csswg.org/css-color/#rgb-functions
|
||||
// FIXME: remove .clone() when lifetimes are non-lexical.
|
||||
let location = arguments.current_source_location();
|
||||
match arguments.next()?.clone() {
|
||||
Token::Number { value: v, .. } => {
|
||||
red = clamp_floor_256_f32(v);
|
||||
green = clamp_floor_256_f32(match arguments.next()?.clone() {
|
||||
Token::Number { value: v, .. } => v,
|
||||
Token::Comma => {
|
||||
uses_commas = true;
|
||||
arguments.expect_number()?
|
||||
}
|
||||
t => return Err(location.new_basic_unexpected_token_error(t))
|
||||
});
|
||||
if uses_commas {
|
||||
arguments.expect_comma()?;
|
||||
}
|
||||
blue = clamp_floor_256_f32(arguments.expect_number()?);
|
||||
let (red, is_number) = match component_parser.parse_number_or_percentage(arguments)? {
|
||||
NumberOrPercentage::Number { value } => {
|
||||
(clamp_floor_256_f32(value), true)
|
||||
}
|
||||
Token::Percentage { unit_value, .. } => {
|
||||
red = clamp_unit_f32(unit_value);
|
||||
green = clamp_unit_f32(match arguments.next()?.clone() {
|
||||
Token::Percentage { unit_value, .. } => unit_value,
|
||||
Token::Comma => {
|
||||
uses_commas = true;
|
||||
arguments.expect_percentage()?
|
||||
}
|
||||
t => return Err(location.new_basic_unexpected_token_error(t))
|
||||
});
|
||||
if uses_commas {
|
||||
arguments.expect_comma()?;
|
||||
}
|
||||
blue = clamp_unit_f32(arguments.expect_percentage()?);
|
||||
NumberOrPercentage::Percentage { unit_value } => {
|
||||
(clamp_unit_f32(unit_value), false)
|
||||
}
|
||||
t => return Err(location.new_basic_unexpected_token_error(t))
|
||||
};
|
||||
return Ok((red, green, blue, uses_commas));
|
||||
|
||||
let uses_commas = arguments.try(|i| i.expect_comma()).is_ok();
|
||||
|
||||
let green;
|
||||
let blue;
|
||||
if is_number {
|
||||
green = clamp_floor_256_f32(component_parser.parse_number(arguments)?);
|
||||
if uses_commas {
|
||||
arguments.expect_comma()?;
|
||||
}
|
||||
blue = clamp_floor_256_f32(component_parser.parse_number(arguments)?);
|
||||
} else {
|
||||
green = clamp_unit_f32(component_parser.parse_percentage(arguments)?);
|
||||
if uses_commas {
|
||||
arguments.expect_comma()?;
|
||||
}
|
||||
blue = clamp_unit_f32(component_parser.parse_percentage(arguments)?);
|
||||
}
|
||||
|
||||
Ok((red, green, blue, uses_commas))
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn parse_rgb_components_hsl<'i, 't>(arguments: &mut Parser<'i, 't>) -> Result<(u8, u8, u8, bool), BasicParseError<'i>> {
|
||||
let mut uses_commas = false;
|
||||
fn parse_rgb_components_hsl<'i, 't, ComponentParser>(
|
||||
component_parser: &ComponentParser,
|
||||
arguments: &mut Parser<'i, 't>
|
||||
) -> Result<(u8, u8, u8, bool), ParseError<'i, ComponentParser::Error>>
|
||||
where
|
||||
ComponentParser: ColorComponentParser<'i>,
|
||||
{
|
||||
// Hue given as an angle
|
||||
// https://drafts.csswg.org/css-values/#angles
|
||||
let location = arguments.current_source_location();
|
||||
let hue_degrees = match *arguments.next()? {
|
||||
Token::Number { value: v, .. } => v,
|
||||
Token::Dimension { value: v, ref unit, .. } => {
|
||||
match_ignore_ascii_case! { &*unit,
|
||||
"deg" => v,
|
||||
"grad" => v * 360. / 400.,
|
||||
"rad" => v * 360. / (2. * PI),
|
||||
"turn" => v * 360.,
|
||||
_ => return Err(location.new_basic_unexpected_token_error(Token::Ident(unit.clone()))),
|
||||
}
|
||||
}
|
||||
ref t => return Err(location.new_basic_unexpected_token_error(t.clone()))
|
||||
};
|
||||
let hue_degrees = component_parser.parse_angle_or_number(arguments)?.degrees();
|
||||
|
||||
// Subtract an integer before rounding, to avoid some rounding errors:
|
||||
let hue_normalized_degrees = hue_degrees - 360. * (hue_degrees / 360.).floor();
|
||||
let hue = hue_normalized_degrees / 360.;
|
||||
|
||||
// Saturation and lightness are clamped to 0% ... 100%
|
||||
// https://drafts.csswg.org/css-color/#the-hsl-notation
|
||||
let location = arguments.current_source_location();
|
||||
let saturation = match arguments.next()?.clone() {
|
||||
Token::Percentage { unit_value, .. } => unit_value,
|
||||
Token::Comma => {
|
||||
uses_commas = true;
|
||||
arguments.expect_percentage()?
|
||||
}
|
||||
t => return Err(location.new_basic_unexpected_token_error(t))
|
||||
};
|
||||
let uses_commas = arguments.try(|i| i.expect_comma()).is_ok();
|
||||
|
||||
let saturation = component_parser.parse_percentage(arguments)?;
|
||||
let saturation = saturation.max(0.).min(1.);
|
||||
|
||||
if uses_commas {
|
||||
arguments.expect_comma()?;
|
||||
}
|
||||
|
||||
let lightness = arguments.expect_percentage()?;
|
||||
let lightness = component_parser.parse_percentage(arguments)?;
|
||||
let lightness = lightness.max(0.).min(1.);
|
||||
|
||||
// https://drafts.csswg.org/css-color/#hsl-color
|
||||
|
|
|
@ -89,7 +89,7 @@ pub use rules_and_declarations::{DeclarationParser, DeclarationListParser, parse
|
|||
pub use rules_and_declarations::{RuleListParser, parse_one_rule};
|
||||
pub use rules_and_declarations::{AtRuleType, QualifiedRuleParser, AtRuleParser};
|
||||
pub use from_bytes::{stylesheet_encoding, EncodingSupport};
|
||||
pub use color::{RGBA, Color, parse_color_keyword};
|
||||
pub use color::{RGBA, Color, parse_color_keyword, AngleOrNumber, NumberOrPercentage, ColorComponentParser};
|
||||
pub use nth::parse_nth;
|
||||
pub use serializer::{ToCss, CssStringWriter, serialize_identifier, serialize_string, TokenSerializationType};
|
||||
pub use parser::{Parser, Delimiter, Delimiters, ParserState, ParserInput};
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
* 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/. */
|
||||
|
||||
use std::ascii::AsciiExt;
|
||||
#[allow(unused_imports)] use std::ascii::AsciiExt;
|
||||
|
||||
use super::{Token, Parser, ParserInput, BasicParseError};
|
||||
|
||||
|
|
|
@ -5,7 +5,7 @@
|
|||
use cow_rc_str::CowRcStr;
|
||||
use smallvec::SmallVec;
|
||||
use std::ops::Range;
|
||||
use std::ascii::AsciiExt;
|
||||
#[allow(unused_imports)] use std::ascii::AsciiExt;
|
||||
use std::ops::BitOr;
|
||||
use tokenizer::{Token, Tokenizer, SourcePosition, SourceLocation};
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
use cow_rc_str::CowRcStr;
|
||||
use parser::{parse_until_before, parse_until_after, parse_nested_block, ParserState};
|
||||
use std::ascii::AsciiExt;
|
||||
#[allow(unused_imports)] use std::ascii::AsciiExt;
|
||||
use super::{Token, Parser, Delimiter, ParseError, BasicParseError, BasicParseErrorKind};
|
||||
|
||||
/// Parse `!important`.
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
use dtoa_short::{self, Notation};
|
||||
use itoa;
|
||||
use std::ascii::AsciiExt;
|
||||
#[allow(unused_imports)] use std::ascii::AsciiExt;
|
||||
use std::fmt::{self, Write};
|
||||
use std::io;
|
||||
use std::str;
|
||||
|
@ -110,7 +110,6 @@ impl<'a> ToCss for Token<'a> {
|
|||
Token::PrefixMatch => dest.write_str("^=")?,
|
||||
Token::SuffixMatch => dest.write_str("$=")?,
|
||||
Token::SubstringMatch => dest.write_str("*=")?,
|
||||
Token::Column => dest.write_str("||")?,
|
||||
Token::CDO => dest.write_str("<!--")?,
|
||||
Token::CDC => dest.write_str("-->")?,
|
||||
|
||||
|
@ -455,7 +454,6 @@ impl<'a> Token<'a> {
|
|||
Token::Comment(_) => DelimSlash,
|
||||
Token::DashMatch => DashMatch,
|
||||
Token::SubstringMatch => SubstringMatch,
|
||||
Token::Column => DelimBar,
|
||||
Token::CDC => CDC,
|
||||
Token::Function(_) => Function,
|
||||
Token::ParenthesisBlock => OpenParen,
|
||||
|
|
|
@ -37,10 +37,10 @@ size_of_test!(std_cow_str, Cow<'static, str>, 32);
|
|||
size_of_test!(cow_rc_str, CowRcStr, 16);
|
||||
|
||||
size_of_test!(tokenizer, ::tokenizer::Tokenizer, 72);
|
||||
size_of_test!(parser_input, ::parser::ParserInput, 144);
|
||||
size_of_test!(parser_input, ::parser::ParserInput, if cfg!(rustc_has_pr45225) { 136 } else { 144 });
|
||||
size_of_test!(parser, ::parser::Parser, 16);
|
||||
size_of_test!(source_position, ::SourcePosition, 8);
|
||||
size_of_test!(parser_state, ::ParserState, 24);
|
||||
|
||||
size_of_test!(basic_parse_error, ::BasicParseError, 48);
|
||||
size_of_test!(parse_error_lower_bound, ::ParseError<()>, 56);
|
||||
size_of_test!(parse_error_lower_bound, ::ParseError<()>, if cfg!(rustc_has_pr45225) { 48 } else { 56 });
|
||||
|
|
|
@ -881,7 +881,6 @@ fn one_component_value_to_json(token: Token, input: &mut Parser) -> Json {
|
|||
Token::PrefixMatch => "^=".to_json(),
|
||||
Token::SuffixMatch => "$=".to_json(),
|
||||
Token::SubstringMatch => "*=".to_json(),
|
||||
Token::Column => "||".to_json(),
|
||||
Token::CDO => "<!--".to_json(),
|
||||
Token::CDC => "-->".to_json(),
|
||||
|
||||
|
|
|
@ -6,7 +6,7 @@
|
|||
|
||||
use std::ops::Range;
|
||||
use std::char;
|
||||
use std::ascii::AsciiExt;
|
||||
#[allow(unused_imports)] use std::ascii::AsciiExt;
|
||||
use std::i32;
|
||||
|
||||
use parser::ParserState;
|
||||
|
@ -132,9 +132,6 @@ pub enum Token<'a> {
|
|||
/// A `*=` [`<substring-match-token>`](https://drafts.csswg.org/css-syntax/#substring-match-token-diagram)
|
||||
SubstringMatch,
|
||||
|
||||
/// A `||` [`<column-token>`](https://drafts.csswg.org/css-syntax/#column-token-diagram)
|
||||
Column,
|
||||
|
||||
/// A `<!--` [`<CDO-token>`](https://drafts.csswg.org/css-syntax/#CDO-token-diagram)
|
||||
CDO,
|
||||
|
||||
|
@ -653,7 +650,6 @@ fn next_token<'a>(tokenizer: &mut Tokenizer<'a>) -> Result<Token<'a>, ()> {
|
|||
b'{' => { tokenizer.advance(1); CurlyBracketBlock },
|
||||
b'|' => {
|
||||
if tokenizer.starts_with(b"|=") { tokenizer.advance(2); DashMatch }
|
||||
else if tokenizer.starts_with(b"||") { tokenizer.advance(2); Column }
|
||||
else { tokenizer.advance(1); Delim('|') }
|
||||
},
|
||||
b'}' => { tokenizer.advance(1); CloseCurlyBracket },
|
||||
|
|
|
@ -0,0 +1 @@
|
|||
{"files":{".travis.yml":"91edce5ea2a1956399db4b17f580c8b7995af3aa9801c4314865f560c55d6d09","Cargo.toml":"107fc4138f10e17b1b3e7b3ac7f95787100fed0a170303f6bbfaee1c0eedea43","README.md":"ecca7edfce86fe7b219535e3c14721d1de838de7035de077a4d497959260bccc","benches/bench.rs":"54cf4879d36ba2a9f3423af91bb93227b70849200e5bf74e384a166d6aa09893","lib.rs":"2d6b7216296c2f1b1e44bf41c0567f5e47de5fa8a3d984200ef315e8b7939aa3"},"package":"8fcd03faf178110ab0334d74ca9631d77f94c8c11cc77fcb59538abf0025695d"}
|
|
@ -0,0 +1,14 @@
|
|||
language: rust
|
||||
rust:
|
||||
- nightly
|
||||
- beta
|
||||
- stable
|
||||
script: |
|
||||
cargo build --verbose &&
|
||||
cargo build --all-features --verbose &&
|
||||
cargo test --verbose &&
|
||||
cargo test --all-features --verbose &&
|
||||
([ $TRAVIS_RUST_VERSION != nightly ] || cargo test --verbose --no-default-features) &&
|
||||
([ $TRAVIS_RUST_VERSION != nightly ] || cargo bench --verbose bench)
|
||||
notifications:
|
||||
webhooks: http://build.servo.org:54856/travis
|
|
@ -0,0 +1,40 @@
|
|||
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
|
||||
#
|
||||
# When uploading crates to the registry Cargo will automatically
|
||||
# "normalize" Cargo.toml files for maximal compatibility
|
||||
# with all versions of Cargo and also rewrite `path` dependencies
|
||||
# to registry (e.g. crates.io) dependencies
|
||||
#
|
||||
# If you believe there's an error in this file please file an
|
||||
# issue against the rust-lang/cargo repository. If you're
|
||||
# editing this file be aware that the upstream Cargo.toml
|
||||
# will likely look very different (and much more reasonable)
|
||||
|
||||
[package]
|
||||
name = "smallvec"
|
||||
version = "0.4.3"
|
||||
authors = ["Simon Sapin <simon.sapin@exyr.org>"]
|
||||
description = "'Small vector' optimization: store up to a small number of items on the stack"
|
||||
documentation = "http://doc.servo.org/smallvec/"
|
||||
readme = "README.md"
|
||||
keywords = ["small", "vec", "vector", "stack", "no_std"]
|
||||
license = "MPL-2.0"
|
||||
repository = "https://github.com/servo/rust-smallvec"
|
||||
|
||||
[lib]
|
||||
name = "smallvec"
|
||||
path = "lib.rs"
|
||||
[dependencies.serde]
|
||||
version = "1"
|
||||
optional = true
|
||||
|
||||
[dependencies.heapsize]
|
||||
version = "0.4"
|
||||
optional = true
|
||||
[dev-dependencies.bincode]
|
||||
version = "0.8"
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = []
|
||||
heapsizeof = ["heapsize", "std"]
|
|
@ -0,0 +1,6 @@
|
|||
rust-smallvec
|
||||
=============
|
||||
|
||||
[Documentation](http://docs.rs/smallvec/)
|
||||
|
||||
"Small vector" optimization for Rust: store up to a small number of items on the stack
|
|
@ -0,0 +1,111 @@
|
|||
#![feature(test)]
|
||||
|
||||
extern crate smallvec;
|
||||
extern crate test;
|
||||
|
||||
use smallvec::SmallVec;
|
||||
use self::test::Bencher;
|
||||
|
||||
#[bench]
|
||||
fn bench_push(b: &mut Bencher) {
|
||||
#[inline(never)]
|
||||
fn push_noinline(vec: &mut SmallVec<[u64; 16]>, x: u64) {
|
||||
vec.push(x)
|
||||
}
|
||||
|
||||
b.iter(|| {
|
||||
let mut vec: SmallVec<[u64; 16]> = SmallVec::new();
|
||||
for x in 0..100 {
|
||||
push_noinline(&mut vec, x);
|
||||
}
|
||||
vec
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_insert(b: &mut Bencher) {
|
||||
#[inline(never)]
|
||||
fn insert_noinline(vec: &mut SmallVec<[u64; 16]>, x: u64) {
|
||||
vec.insert(0, x)
|
||||
}
|
||||
|
||||
b.iter(|| {
|
||||
let mut vec: SmallVec<[u64; 16]> = SmallVec::new();
|
||||
for x in 0..100 {
|
||||
insert_noinline(&mut vec, x);
|
||||
}
|
||||
vec
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_insert_many(b: &mut Bencher) {
|
||||
#[inline(never)]
|
||||
fn insert_many_noinline<I: IntoIterator<Item=u64>>(
|
||||
vec: &mut SmallVec<[u64; 16]>, index: usize, iterable: I) {
|
||||
vec.insert_many(index, iterable)
|
||||
}
|
||||
|
||||
b.iter(|| {
|
||||
let mut vec: SmallVec<[u64; 16]> = SmallVec::new();
|
||||
insert_many_noinline(&mut vec, 0, 0..100);
|
||||
insert_many_noinline(&mut vec, 0, 0..100);
|
||||
vec
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_extend(b: &mut Bencher) {
|
||||
b.iter(|| {
|
||||
let mut vec: SmallVec<[u64; 16]> = SmallVec::new();
|
||||
vec.extend(0..100);
|
||||
vec
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_from_slice(b: &mut Bencher) {
|
||||
let v: Vec<u64> = (0..100).collect();
|
||||
b.iter(|| {
|
||||
let vec: SmallVec<[u64; 16]> = SmallVec::from_slice(&v);
|
||||
vec
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_extend_from_slice(b: &mut Bencher) {
|
||||
let v: Vec<u64> = (0..100).collect();
|
||||
b.iter(|| {
|
||||
let mut vec: SmallVec<[u64; 16]> = SmallVec::new();
|
||||
vec.extend_from_slice(&v);
|
||||
vec
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_insert_from_slice(b: &mut Bencher) {
|
||||
let v: Vec<u64> = (0..100).collect();
|
||||
b.iter(|| {
|
||||
let mut vec: SmallVec<[u64; 16]> = SmallVec::new();
|
||||
vec.insert_from_slice(0, &v);
|
||||
vec.insert_from_slice(0, &v);
|
||||
vec
|
||||
});
|
||||
}
|
||||
|
||||
#[bench]
|
||||
fn bench_pushpop(b: &mut Bencher) {
|
||||
#[inline(never)]
|
||||
fn pushpop_noinline(vec: &mut SmallVec<[u64; 16]>, x: u64) {
|
||||
vec.push(x);
|
||||
vec.pop();
|
||||
}
|
||||
|
||||
b.iter(|| {
|
||||
let mut vec: SmallVec<[u64; 16]> = SmallVec::new();
|
||||
for x in 0..100 {
|
||||
pushpop_noinline(&mut vec, x);
|
||||
}
|
||||
vec
|
||||
});
|
||||
}
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -1 +1 @@
|
|||
{"files":{".travis.yml":"91edce5ea2a1956399db4b17f580c8b7995af3aa9801c4314865f560c55d6d09","Cargo.toml":"107fc4138f10e17b1b3e7b3ac7f95787100fed0a170303f6bbfaee1c0eedea43","README.md":"ecca7edfce86fe7b219535e3c14721d1de838de7035de077a4d497959260bccc","benches/bench.rs":"54cf4879d36ba2a9f3423af91bb93227b70849200e5bf74e384a166d6aa09893","lib.rs":"2d6b7216296c2f1b1e44bf41c0567f5e47de5fa8a3d984200ef315e8b7939aa3"},"package":"8fcd03faf178110ab0334d74ca9631d77f94c8c11cc77fcb59538abf0025695d"}
|
||||
{"files":{".travis.yml":"91edce5ea2a1956399db4b17f580c8b7995af3aa9801c4314865f560c55d6d09","Cargo.toml":"1bbfc40ffd7370696242dd27dd4f0e211d3309aebca8b564029a6ac167e81726","LICENSE":"b946744aeda89b467929585fe8eeb5461847695220c1b168fb375d8abd4ea3d0","README.md":"1bc64a621160a291c86b8770f3eeaa45a31c31d91c2a071f39981c14fdacb035","benches/bench.rs":"54cf4879d36ba2a9f3423af91bb93227b70849200e5bf74e384a166d6aa09893","lib.rs":"bd237262110649b266c6599d4f8b3d1f7d7c758d6852b65243c8221811d273e8"},"package":"44db0ecb22921ef790d17ae13a3f6d15784183ff5f2a01aa32098c7498d2b4b9"}
|
|
@ -12,12 +12,13 @@
|
|||
|
||||
[package]
|
||||
name = "smallvec"
|
||||
version = "0.4.3"
|
||||
version = "0.6.0"
|
||||
authors = ["Simon Sapin <simon.sapin@exyr.org>"]
|
||||
description = "'Small vector' optimization: store up to a small number of items on the stack"
|
||||
documentation = "http://doc.servo.org/smallvec/"
|
||||
readme = "README.md"
|
||||
keywords = ["small", "vec", "vector", "stack", "no_std"]
|
||||
categories = ["data-structures"]
|
||||
license = "MPL-2.0"
|
||||
repository = "https://github.com/servo/rust-smallvec"
|
||||
|
||||
|
@ -27,14 +28,9 @@ path = "lib.rs"
|
|||
[dependencies.serde]
|
||||
version = "1"
|
||||
optional = true
|
||||
|
||||
[dependencies.heapsize]
|
||||
version = "0.4"
|
||||
optional = true
|
||||
[dev-dependencies.bincode]
|
||||
version = "0.8"
|
||||
|
||||
[features]
|
||||
default = ["std"]
|
||||
std = []
|
||||
heapsizeof = ["heapsize", "std"]
|
||||
|
|
|
@ -0,0 +1,374 @@
|
|||
Mozilla Public License Version 2.0
|
||||
==================================
|
||||
|
||||
1. Definitions
|
||||
--------------
|
||||
|
||||
1.1. "Contributor"
|
||||
means each individual or legal entity that creates, contributes to
|
||||
the creation of, or owns Covered Software.
|
||||
|
||||
1.2. "Contributor Version"
|
||||
means the combination of the Contributions of others (if any) used
|
||||
by a Contributor and that particular Contributor's Contribution.
|
||||
|
||||
1.3. "Contribution"
|
||||
means Covered Software of a particular Contributor.
|
||||
|
||||
1.4. "Covered Software"
|
||||
means Source Code Form to which the initial Contributor has attached
|
||||
the notice in Exhibit A, the Executable Form of such Source Code
|
||||
Form, and Modifications of such Source Code Form, in each case
|
||||
including portions thereof.
|
||||
|
||||
1.5. "Incompatible With Secondary Licenses"
|
||||
means
|
||||
|
||||
(a) that the initial Contributor has attached the notice described
|
||||
in Exhibit B to the Covered Software; or
|
||||
|
||||
(b) that the Covered Software was made available under the terms of
|
||||
version 1.1 or earlier of the License, but not also under the
|
||||
terms of a Secondary License.
|
||||
|
||||
1.6. "Executable Form"
|
||||
means any form of the work other than Source Code Form.
|
||||
|
||||
1.7. "Larger Work"
|
||||
means a work that combines Covered Software with other material, in
|
||||
a separate file or files, that is not Covered Software.
|
||||
|
||||
1.8. "License"
|
||||
means this document.
|
||||
|
||||
1.9. "Licensable"
|
||||
means having the right to grant, to the maximum extent possible,
|
||||
whether at the time of the initial grant or subsequently, any and
|
||||
all of the rights conveyed by this License.
|
||||
|
||||
1.10. "Modifications"
|
||||
means any of the following:
|
||||
|
||||
(a) any file in Source Code Form that results from an addition to,
|
||||
deletion from, or modification of the contents of Covered
|
||||
Software; or
|
||||
|
||||
(b) any new file in Source Code Form that contains any Covered
|
||||
Software.
|
||||
|
||||
1.11. "Patent Claims" of a Contributor
|
||||
means any patent claim(s), including without limitation, method,
|
||||
process, and apparatus claims, in any patent Licensable by such
|
||||
Contributor that would be infringed, but for the grant of the
|
||||
License, by the making, using, selling, offering for sale, having
|
||||
made, import, or transfer of either its Contributions or its
|
||||
Contributor Version.
|
||||
|
||||
1.12. "Secondary License"
|
||||
means either the GNU General Public License, Version 2.0, the GNU
|
||||
Lesser General Public License, Version 2.1, the GNU Affero General
|
||||
Public License, Version 3.0, or any later versions of those
|
||||
licenses.
|
||||
|
||||
1.13. "Source Code Form"
|
||||
means the form of the work preferred for making modifications.
|
||||
|
||||
1.14. "You" (or "Your")
|
||||
means an individual or a legal entity exercising rights under this
|
||||
License. For legal entities, "You" includes any entity that
|
||||
controls, is controlled by, or is under common control with You. For
|
||||
purposes of this definition, "control" means (a) the power, direct
|
||||
or indirect, to cause the direction or management of such entity,
|
||||
whether by contract or otherwise, or (b) ownership of more than
|
||||
fifty percent (50%) of the outstanding shares or beneficial
|
||||
ownership of such entity.
|
||||
|
||||
2. License Grants and Conditions
|
||||
--------------------------------
|
||||
|
||||
2.1. Grants
|
||||
|
||||
Each Contributor hereby grants You a world-wide, royalty-free,
|
||||
non-exclusive license:
|
||||
|
||||
(a) under intellectual property rights (other than patent or trademark)
|
||||
Licensable by such Contributor to use, reproduce, make available,
|
||||
modify, display, perform, distribute, and otherwise exploit its
|
||||
Contributions, either on an unmodified basis, with Modifications, or
|
||||
as part of a Larger Work; and
|
||||
|
||||
(b) under Patent Claims of such Contributor to make, use, sell, offer
|
||||
for sale, have made, import, and otherwise transfer either its
|
||||
Contributions or its Contributor Version.
|
||||
|
||||
2.2. Effective Date
|
||||
|
||||
The licenses granted in Section 2.1 with respect to any Contribution
|
||||
become effective for each Contribution on the date the Contributor first
|
||||
distributes such Contribution.
|
||||
|
||||
2.3. Limitations on Grant Scope
|
||||
|
||||
The licenses granted in this Section 2 are the only rights granted under
|
||||
this License. No additional rights or licenses will be implied from the
|
||||
distribution or licensing of Covered Software under this License.
|
||||
Notwithstanding Section 2.1(b) above, no patent license is granted by a
|
||||
Contributor:
|
||||
|
||||
(a) for any code that a Contributor has removed from Covered Software;
|
||||
or
|
||||
|
||||
(b) for infringements caused by: (i) Your and any other third party's
|
||||
modifications of Covered Software, or (ii) the combination of its
|
||||
Contributions with other software (except as part of its Contributor
|
||||
Version); or
|
||||
|
||||
(c) under Patent Claims infringed by Covered Software in the absence of
|
||||
its Contributions.
|
||||
|
||||
This License does not grant any rights in the trademarks, service marks,
|
||||
or logos of any Contributor (except as may be necessary to comply with
|
||||
the notice requirements in Section 3.4).
|
||||
|
||||
2.4. Subsequent Licenses
|
||||
|
||||
No Contributor makes additional grants as a result of Your choice to
|
||||
distribute the Covered Software under a subsequent version of this
|
||||
License (see Section 10.2) or under the terms of a Secondary License (if
|
||||
permitted under the terms of Section 3.3).
|
||||
|
||||
2.5. Representation
|
||||
|
||||
Each Contributor represents that the Contributor believes its
|
||||
Contributions are its original creation(s) or it has sufficient rights
|
||||
to grant the rights to its Contributions conveyed by this License.
|
||||
|
||||
2.6. Fair Use
|
||||
|
||||
This License is not intended to limit any rights You have under
|
||||
applicable copyright doctrines of fair use, fair dealing, or other
|
||||
equivalents.
|
||||
|
||||
2.7. Conditions
|
||||
|
||||
Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted
|
||||
in Section 2.1.
|
||||
|
||||
3. Responsibilities
|
||||
-------------------
|
||||
|
||||
3.1. Distribution of Source Form
|
||||
|
||||
All distribution of Covered Software in Source Code Form, including any
|
||||
Modifications that You create or to which You contribute, must be under
|
||||
the terms of this License. You must inform recipients that the Source
|
||||
Code Form of the Covered Software is governed by the terms of this
|
||||
License, and how they can obtain a copy of this License. You may not
|
||||
attempt to alter or restrict the recipients' rights in the Source Code
|
||||
Form.
|
||||
|
||||
3.2. Distribution of Executable Form
|
||||
|
||||
If You distribute Covered Software in Executable Form then:
|
||||
|
||||
(a) such Covered Software must also be made available in Source Code
|
||||
Form, as described in Section 3.1, and You must inform recipients of
|
||||
the Executable Form how they can obtain a copy of such Source Code
|
||||
Form by reasonable means in a timely manner, at a charge no more
|
||||
than the cost of distribution to the recipient; and
|
||||
|
||||
(b) You may distribute such Executable Form under the terms of this
|
||||
License, or sublicense it under different terms, provided that the
|
||||
license for the Executable Form does not attempt to limit or alter
|
||||
the recipients' rights in the Source Code Form under this License.
|
||||
|
||||
3.3. Distribution of a Larger Work
|
||||
|
||||
You may create and distribute a Larger Work under terms of Your choice,
|
||||
provided that You also comply with the requirements of this License for
|
||||
the Covered Software. If the Larger Work is a combination of Covered
|
||||
Software with a work governed by one or more Secondary Licenses, and the
|
||||
Covered Software is not Incompatible With Secondary Licenses, this
|
||||
License permits You to additionally distribute such Covered Software
|
||||
under the terms of such Secondary License(s), so that the recipient of
|
||||
the Larger Work may, at their option, further distribute the Covered
|
||||
Software under the terms of either this License or such Secondary
|
||||
License(s).
|
||||
|
||||
3.4. Notices
|
||||
|
||||
You may not remove or alter the substance of any license notices
|
||||
(including copyright notices, patent notices, disclaimers of warranty,
|
||||
or limitations of liability) contained within the Source Code Form of
|
||||
the Covered Software, except that You may alter any license notices to
|
||||
the extent required to remedy known factual inaccuracies.
|
||||
|
||||
3.5. Application of Additional Terms
|
||||
|
||||
You may choose to offer, and to charge a fee for, warranty, support,
|
||||
indemnity or liability obligations to one or more recipients of Covered
|
||||
Software. However, You may do so only on Your own behalf, and not on
|
||||
behalf of any Contributor. You must make it absolutely clear that any
|
||||
such warranty, support, indemnity, or liability obligation is offered by
|
||||
You alone, and You hereby agree to indemnify every Contributor for any
|
||||
liability incurred by such Contributor as a result of warranty, support,
|
||||
indemnity or liability terms You offer. You may include additional
|
||||
disclaimers of warranty and limitations of liability specific to any
|
||||
jurisdiction.
|
||||
|
||||
4. Inability to Comply Due to Statute or Regulation
|
||||
---------------------------------------------------
|
||||
|
||||
If it is impossible for You to comply with any of the terms of this
|
||||
License with respect to some or all of the Covered Software due to
|
||||
statute, judicial order, or regulation then You must: (a) comply with
|
||||
the terms of this License to the maximum extent possible; and (b)
|
||||
describe the limitations and the code they affect. Such description must
|
||||
be placed in a text file included with all distributions of the Covered
|
||||
Software under this License. Except to the extent prohibited by statute
|
||||
or regulation, such description must be sufficiently detailed for a
|
||||
recipient of ordinary skill to be able to understand it.
|
||||
|
||||
5. Termination
|
||||
--------------
|
||||
|
||||
5.1. The rights granted under this License will terminate automatically
|
||||
if You fail to comply with any of its terms. However, if You become
|
||||
compliant, then the rights granted under this License from a particular
|
||||
Contributor are reinstated (a) provisionally, unless and until such
|
||||
Contributor explicitly and finally terminates Your grants, and (b) on an
|
||||
ongoing basis, if such Contributor fails to notify You of the
|
||||
non-compliance by some reasonable means prior to 60 days after You have
|
||||
come back into compliance. Moreover, Your grants from a particular
|
||||
Contributor are reinstated on an ongoing basis if such Contributor
|
||||
notifies You of the non-compliance by some reasonable means, this is the
|
||||
first time You have received notice of non-compliance with this License
|
||||
from such Contributor, and You become compliant prior to 30 days after
|
||||
Your receipt of the notice.
|
||||
|
||||
5.2. If You initiate litigation against any entity by asserting a patent
|
||||
infringement claim (excluding declaratory judgment actions,
|
||||
counter-claims, and cross-claims) alleging that a Contributor Version
|
||||
directly or indirectly infringes any patent, then the rights granted to
|
||||
You by any and all Contributors for the Covered Software under Section
|
||||
2.1 of this License shall terminate.
|
||||
|
||||
5.3. In the event of termination under Sections 5.1 or 5.2 above, all
|
||||
end user license agreements (excluding distributors and resellers) which
|
||||
have been validly granted by You or Your distributors under this License
|
||||
prior to termination shall survive termination.
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 6. Disclaimer of Warranty *
|
||||
* ------------------------- *
|
||||
* *
|
||||
* Covered Software is provided under this License on an "as is" *
|
||||
* basis, without warranty of any kind, either expressed, implied, or *
|
||||
* statutory, including, without limitation, warranties that the *
|
||||
* Covered Software is free of defects, merchantable, fit for a *
|
||||
* particular purpose or non-infringing. The entire risk as to the *
|
||||
* quality and performance of the Covered Software is with You. *
|
||||
* Should any Covered Software prove defective in any respect, You *
|
||||
* (not any Contributor) assume the cost of any necessary servicing, *
|
||||
* repair, or correction. This disclaimer of warranty constitutes an *
|
||||
* essential part of this License. No use of any Covered Software is *
|
||||
* authorized under this License except under this disclaimer. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
************************************************************************
|
||||
* *
|
||||
* 7. Limitation of Liability *
|
||||
* -------------------------- *
|
||||
* *
|
||||
* Under no circumstances and under no legal theory, whether tort *
|
||||
* (including negligence), contract, or otherwise, shall any *
|
||||
* Contributor, or anyone who distributes Covered Software as *
|
||||
* permitted above, be liable to You for any direct, indirect, *
|
||||
* special, incidental, or consequential damages of any character *
|
||||
* including, without limitation, damages for lost profits, loss of *
|
||||
* goodwill, work stoppage, computer failure or malfunction, or any *
|
||||
* and all other commercial damages or losses, even if such party *
|
||||
* shall have been informed of the possibility of such damages. This *
|
||||
* limitation of liability shall not apply to liability for death or *
|
||||
* personal injury resulting from such party's negligence to the *
|
||||
* extent applicable law prohibits such limitation. Some *
|
||||
* jurisdictions do not allow the exclusion or limitation of *
|
||||
* incidental or consequential damages, so this exclusion and *
|
||||
* limitation may not apply to You. *
|
||||
* *
|
||||
************************************************************************
|
||||
|
||||
8. Litigation
|
||||
-------------
|
||||
|
||||
Any litigation relating to this License may be brought only in the
|
||||
courts of a jurisdiction where the defendant maintains its principal
|
||||
place of business and such litigation shall be governed by laws of that
|
||||
jurisdiction, without reference to its conflict-of-law provisions.
|
||||
Nothing in this Section shall prevent a party's ability to bring
|
||||
cross-claims or counter-claims.
|
||||
|
||||
9. Miscellaneous
|
||||
----------------
|
||||
|
||||
This License represents the complete agreement concerning the subject
|
||||
matter hereof. If any provision of this License is held to be
|
||||
unenforceable, such provision shall be reformed only to the extent
|
||||
necessary to make it enforceable. Any law or regulation which provides
|
||||
that the language of a contract shall be construed against the drafter
|
||||
shall not be used to construe this License against a Contributor.
|
||||
|
||||
10. Versions of the License
|
||||
---------------------------
|
||||
|
||||
10.1. New Versions
|
||||
|
||||
Mozilla Foundation is the license steward. Except as provided in Section
|
||||
10.3, no one other than the license steward has the right to modify or
|
||||
publish new versions of this License. Each version will be given a
|
||||
distinguishing version number.
|
||||
|
||||
10.2. Effect of New Versions
|
||||
|
||||
You may distribute the Covered Software under the terms of the version
|
||||
of the License under which You originally received the Covered Software,
|
||||
or under the terms of any subsequent version published by the license
|
||||
steward.
|
||||
|
||||
10.3. Modified Versions
|
||||
|
||||
If you create software not governed by this License, and you want to
|
||||
create a new license for such software, you may create and use a
|
||||
modified version of this License if you rename the license and remove
|
||||
any references to the name of the license steward (except to note that
|
||||
such modified license differs from this License).
|
||||
|
||||
10.4. Distributing Source Code Form that is Incompatible With Secondary
|
||||
Licenses
|
||||
|
||||
If You choose to distribute Source Code Form that is Incompatible With
|
||||
Secondary Licenses under the terms of this version of the License, the
|
||||
notice described in Exhibit B of this License must be attached.
|
||||
|
||||
Exhibit A - Source Code Form License Notice
|
||||
-------------------------------------------
|
||||
|
||||
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/.
|
||||
|
||||
If it is not possible or desirable to put the notice in a particular
|
||||
file, then You may include the notice in a location (such as a LICENSE
|
||||
file in a relevant directory) where a recipient would be likely to look
|
||||
for such a notice.
|
||||
|
||||
You may add additional accurate notices of copyright ownership.
|
||||
|
||||
Exhibit B - "Incompatible With Secondary Licenses" Notice
|
||||
---------------------------------------------------------
|
||||
|
||||
This Source Code Form is "Incompatible With Secondary Licenses", as
|
||||
defined by the Mozilla Public License, v. 2.0.
|
||||
|
|
@ -3,4 +3,6 @@ rust-smallvec
|
|||
|
||||
[Documentation](http://docs.rs/smallvec/)
|
||||
|
||||
[Release notes](https://github.com/servo/rust-smallvec/releases)
|
||||
|
||||
"Small vector" optimization for Rust: store up to a small number of items on the stack
|
||||
|
|
|
@ -17,6 +17,7 @@
|
|||
|
||||
#![cfg_attr(not(feature = "std"), no_std)]
|
||||
#![cfg_attr(not(feature = "std"), feature(alloc))]
|
||||
#![deny(missing_docs)]
|
||||
|
||||
|
||||
#[cfg(not(feature = "std"))]
|
||||
|
@ -26,9 +27,6 @@ extern crate alloc;
|
|||
#[cfg(not(feature = "std"))]
|
||||
use alloc::Vec;
|
||||
|
||||
#[cfg(feature="heapsizeof")]
|
||||
extern crate heapsize;
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
extern crate serde;
|
||||
|
||||
|
@ -48,8 +46,6 @@ use std::ptr;
|
|||
use std::slice;
|
||||
#[cfg(feature = "std")]
|
||||
use std::io;
|
||||
#[cfg(feature="heapsizeof")]
|
||||
use std::os::raw::c_void;
|
||||
#[cfg(feature = "serde")]
|
||||
use serde::ser::{Serialize, Serializer, SerializeSeq};
|
||||
#[cfg(feature = "serde")]
|
||||
|
@ -57,8 +53,6 @@ use serde::de::{Deserialize, Deserializer, SeqAccess, Visitor};
|
|||
#[cfg(feature = "serde")]
|
||||
use std::marker::PhantomData;
|
||||
|
||||
#[cfg(feature="heapsizeof")]
|
||||
use heapsize::{HeapSizeOf, heap_size_of};
|
||||
use SmallVecData::{Inline, Heap};
|
||||
|
||||
/// Common operations implemented by both `Vec` and `SmallVec`.
|
||||
|
@ -68,7 +62,7 @@ use SmallVecData::{Inline, Heap};
|
|||
/// ## Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use smallvec::{VecLike, SmallVec8};
|
||||
/// use smallvec::{VecLike, SmallVec};
|
||||
///
|
||||
/// fn initialize<V: VecLike<u8>>(v: &mut V) {
|
||||
/// for i in 0..5 {
|
||||
|
@ -79,9 +73,10 @@ use SmallVecData::{Inline, Heap};
|
|||
/// let mut vec = Vec::new();
|
||||
/// initialize(&mut vec);
|
||||
///
|
||||
/// let mut small_vec = SmallVec8::new();
|
||||
/// let mut small_vec = SmallVec::<[u8; 8]>::new();
|
||||
/// initialize(&mut small_vec);
|
||||
/// ```
|
||||
#[deprecated(note = "Use `Extend` and `Deref<[T]>` instead")]
|
||||
pub trait VecLike<T>:
|
||||
ops::Index<usize, Output=T> +
|
||||
ops::IndexMut<usize> +
|
||||
|
@ -100,6 +95,7 @@ pub trait VecLike<T>:
|
|||
fn push(&mut self, value: T);
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
impl<T> VecLike<T> for Vec<T> {
|
||||
#[inline]
|
||||
fn push(&mut self, value: T) {
|
||||
|
@ -112,7 +108,7 @@ impl<T> VecLike<T> for Vec<T> {
|
|||
/// ## Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use smallvec::{ExtendFromSlice, SmallVec8};
|
||||
/// use smallvec::{ExtendFromSlice, SmallVec};
|
||||
///
|
||||
/// fn initialize<V: ExtendFromSlice<u8>>(v: &mut V) {
|
||||
/// v.extend_from_slice(b"Test!");
|
||||
|
@ -122,11 +118,11 @@ impl<T> VecLike<T> for Vec<T> {
|
|||
/// initialize(&mut vec);
|
||||
/// assert_eq!(&vec, b"Test!");
|
||||
///
|
||||
/// let mut small_vec = SmallVec8::new();
|
||||
/// let mut small_vec = SmallVec::<[u8; 8]>::new();
|
||||
/// initialize(&mut small_vec);
|
||||
/// assert_eq!(&small_vec as &[_], b"Test!");
|
||||
/// ```
|
||||
pub trait ExtendFromSlice<T>: VecLike<T> {
|
||||
pub trait ExtendFromSlice<T> {
|
||||
/// Extends a collection from a slice of its element type
|
||||
fn extend_from_slice(&mut self, other: &[T]);
|
||||
}
|
||||
|
@ -142,6 +138,11 @@ unsafe fn deallocate<T>(ptr: *mut T, capacity: usize) {
|
|||
// Let it drop.
|
||||
}
|
||||
|
||||
/// An iterator that removes the items from a `SmallVec` and yields them by value.
|
||||
///
|
||||
/// Returned from [`SmallVec::drain`][1].
|
||||
///
|
||||
/// [1]: struct.SmallVec.html#method.drain
|
||||
pub struct Drain<'a, T: 'a> {
|
||||
iter: slice::IterMut<'a,T>,
|
||||
}
|
||||
|
@ -234,19 +235,13 @@ impl<A: Array> Drop for SmallVecData<A> {
|
|||
/// store can be any type that implements the `Array` trait; usually it is a small fixed-sized
|
||||
/// array. For example a `SmallVec<[u64; 8]>` can hold up to eight 64-bit integers inline.
|
||||
///
|
||||
/// Type aliases like `SmallVec8<T>` are provided as convenient shorthand for types like
|
||||
/// `SmallVec<[T; 8]>`.
|
||||
///
|
||||
/// ## Example
|
||||
///
|
||||
/// ```rust
|
||||
/// use smallvec::SmallVec;
|
||||
/// let mut v = SmallVec::<[u8; 4]>::new(); // initialize an empty vector
|
||||
///
|
||||
/// use smallvec::SmallVec4;
|
||||
/// let mut v: SmallVec4<u8> = SmallVec::new(); // alternate way to write the above
|
||||
///
|
||||
/// // SmallVec4 can hold up to 4 items without spilling onto the heap.
|
||||
/// // The vector can hold up to 4 items without spilling onto the heap.
|
||||
/// v.extend(0..4);
|
||||
/// assert_eq!(v.len(), 4);
|
||||
/// assert!(!v.spilled());
|
||||
|
@ -273,6 +268,26 @@ impl<A: Array> SmallVec<A> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Construct an empty vector with enough capacity pre-allocated to store at least `n`
|
||||
/// elements.
|
||||
///
|
||||
/// Will create a heap allocation only if `n` is larger than the inline capacity.
|
||||
///
|
||||
/// ```
|
||||
/// # use smallvec::SmallVec;
|
||||
///
|
||||
/// let v: SmallVec<[u8; 3]> = SmallVec::with_capacity(100);
|
||||
///
|
||||
/// assert!(v.is_empty());
|
||||
/// assert!(v.capacity() >= 100);
|
||||
/// ```
|
||||
#[inline]
|
||||
pub fn with_capacity(n: usize) -> Self {
|
||||
let mut v = SmallVec::new();
|
||||
v.reserve_exact(n);
|
||||
v
|
||||
}
|
||||
|
||||
/// Construct a new `SmallVec` from a `Vec<A::Item>` without copying
|
||||
/// elements.
|
||||
///
|
||||
|
@ -393,14 +408,6 @@ impl<A: Array> SmallVec<A> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Append elements from an iterator.
|
||||
///
|
||||
/// This function is deprecated; it has been replaced by `Extend::extend`.
|
||||
#[deprecated(note = "Use `extend` instead")]
|
||||
pub fn push_all_move<V: IntoIterator<Item=A::Item>>(&mut self, other: V) {
|
||||
self.extend(other)
|
||||
}
|
||||
|
||||
/// Remove an item from the end of the vector and return it, or None if empty.
|
||||
#[inline]
|
||||
pub fn pop(&mut self) -> Option<A::Item> {
|
||||
|
@ -412,8 +419,8 @@ impl<A: Array> SmallVec<A> {
|
|||
panic!("overflow")
|
||||
}
|
||||
unsafe {
|
||||
let end_ptr = self.as_mut_ptr().offset(last_index as isize);
|
||||
let value = ptr::replace(end_ptr, mem::uninitialized());
|
||||
let end_ptr = self.as_ptr().offset(last_index as isize);
|
||||
let value = ptr::read(end_ptr);
|
||||
self.set_len(last_index);
|
||||
Some(value)
|
||||
}
|
||||
|
@ -510,6 +517,20 @@ impl<A: Array> SmallVec<A> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Extracts a slice containing the entire vector.
|
||||
///
|
||||
/// Equivalent to `&mut s[..]`.
|
||||
pub fn as_slice(&self) -> &[A::Item] {
|
||||
self
|
||||
}
|
||||
|
||||
/// Extracts a mutable slice of the entire vector.
|
||||
///
|
||||
/// Equivalent to `&mut s[..]`.
|
||||
pub fn as_mut_slice(&mut self) -> &mut [A::Item] {
|
||||
self
|
||||
}
|
||||
|
||||
/// Remove the element at position `index`, replacing it with the last element.
|
||||
///
|
||||
/// This does not preserve ordering, but is O(1).
|
||||
|
@ -563,6 +584,8 @@ impl<A: Array> SmallVec<A> {
|
|||
}
|
||||
}
|
||||
|
||||
/// Insert multiple elements at position `index`, shifting all following elements toward the
|
||||
/// back.
|
||||
pub fn insert_many<I: IntoIterator<Item=A::Item>>(&mut self, index: usize, iterable: I) {
|
||||
let iter = iterable.into_iter();
|
||||
let (lower_size_bound, _) = iter.size_hint();
|
||||
|
@ -611,11 +634,11 @@ impl<A: Array> SmallVec<A> {
|
|||
/// In other words, remove all elements `e` such that `f(&e)` returns `false`.
|
||||
/// This method operates in place and preserves the order of the retained
|
||||
/// elements.
|
||||
pub fn retain<F: FnMut(&A::Item) -> bool>(&mut self, mut f: F) {
|
||||
pub fn retain<F: FnMut(&mut A::Item) -> bool>(&mut self, mut f: F) {
|
||||
let mut del = 0;
|
||||
let len = self.len;
|
||||
for i in 0..len {
|
||||
if !f(&self[i]) {
|
||||
if !f(&mut self[i]) {
|
||||
del += 1;
|
||||
} else if del > 0 {
|
||||
self.swap(i - del, i);
|
||||
|
@ -623,15 +646,66 @@ impl<A: Array> SmallVec<A> {
|
|||
}
|
||||
self.truncate(len - del);
|
||||
}
|
||||
|
||||
/// Removes consecutive duplicate elements.
|
||||
pub fn dedup(&mut self) where A::Item: PartialEq<A::Item> {
|
||||
self.dedup_by(|a, b| a == b);
|
||||
}
|
||||
|
||||
/// Removes consecutive duplicate elements using the given equality relation.
|
||||
pub fn dedup_by<F>(&mut self, mut same_bucket: F)
|
||||
where F: FnMut(&mut A::Item, &mut A::Item) -> bool
|
||||
{
|
||||
// See the implementation of Vec::dedup_by in the
|
||||
// standard library for an explanation of this algorithm.
|
||||
let len = self.len;
|
||||
if len <= 1 {
|
||||
return;
|
||||
}
|
||||
|
||||
let ptr = self.as_mut_ptr();
|
||||
let mut w: usize = 1;
|
||||
|
||||
unsafe {
|
||||
for r in 1..len {
|
||||
let p_r = ptr.offset(r as isize);
|
||||
let p_wm1 = ptr.offset((w - 1) as isize);
|
||||
if !same_bucket(&mut *p_r, &mut *p_wm1) {
|
||||
if r != w {
|
||||
let p_w = p_wm1.offset(1);
|
||||
mem::swap(&mut *p_r, &mut *p_w);
|
||||
}
|
||||
w += 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
self.truncate(w);
|
||||
}
|
||||
|
||||
/// Removes consecutive elements that map to the same key.
|
||||
pub fn dedup_by_key<F, K>(&mut self, mut key: F)
|
||||
where F: FnMut(&mut A::Item) -> K,
|
||||
K: PartialEq<K>
|
||||
{
|
||||
self.dedup_by(|a, b| key(a) == key(b));
|
||||
}
|
||||
}
|
||||
|
||||
impl<A: Array> SmallVec<A> where A::Item: Copy {
|
||||
/// Copy the elements from a slice into a new `SmallVec`.
|
||||
///
|
||||
/// For slices of `Copy` types, this is more efficient than `SmallVec::from(slice)`.
|
||||
pub fn from_slice(slice: &[A::Item]) -> Self {
|
||||
let mut vec = Self::new();
|
||||
vec.extend_from_slice(slice);
|
||||
vec
|
||||
}
|
||||
|
||||
/// Copy elements from a slice into the vector at position `index`, shifting any following
|
||||
/// elements toward the back.
|
||||
///
|
||||
/// For slices of `Copy` types, this is more efficient than `insert`.
|
||||
pub fn insert_from_slice(&mut self, index: usize, slice: &[A::Item]) {
|
||||
self.reserve(slice.len());
|
||||
|
||||
|
@ -642,11 +716,14 @@ impl<A: Array> SmallVec<A> where A::Item: Copy {
|
|||
let slice_ptr = slice.as_ptr();
|
||||
let ptr = self.as_mut_ptr().offset(index as isize);
|
||||
ptr::copy(ptr, ptr.offset(slice.len() as isize), len - index);
|
||||
ptr::copy(slice_ptr, ptr, slice.len());
|
||||
ptr::copy_nonoverlapping(slice_ptr, ptr, slice.len());
|
||||
self.set_len(len + slice.len());
|
||||
}
|
||||
}
|
||||
|
||||
/// Copy elements from a slice and append them to the vector.
|
||||
///
|
||||
/// For slices of `Copy` types, this is more efficient than `extend`.
|
||||
#[inline]
|
||||
pub fn extend_from_slice(&mut self, slice: &[A::Item]) {
|
||||
let len = self.len();
|
||||
|
@ -654,20 +731,6 @@ impl<A: Array> SmallVec<A> where A::Item: Copy {
|
|||
}
|
||||
}
|
||||
|
||||
#[cfg(feature="heapsizeof")]
|
||||
impl<A: Array> HeapSizeOf for SmallVec<A> where A::Item: HeapSizeOf {
|
||||
fn heap_size_of_children(&self) -> usize {
|
||||
match self.data {
|
||||
Inline { .. } => 0,
|
||||
Heap { ptr, .. } => {
|
||||
self.iter().fold(
|
||||
unsafe { heap_size_of(ptr as *const c_void) },
|
||||
|n, elem| n + elem.heap_size_of_children())
|
||||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<A: Array> ops::Deref for SmallVec<A> {
|
||||
type Target = [A::Item];
|
||||
#[inline]
|
||||
|
@ -777,7 +840,8 @@ where A::Item: Deserialize<'de>,
|
|||
where
|
||||
B: SeqAccess<'de>,
|
||||
{
|
||||
let mut values = SmallVec::new();
|
||||
let len = seq.size_hint().unwrap_or(0);
|
||||
let mut values = SmallVec::with_capacity(len);
|
||||
|
||||
while let Some(value) = seq.next_element()? {
|
||||
values.push(value);
|
||||
|
@ -794,6 +858,20 @@ impl<'a, A: Array> From<&'a [A::Item]> for SmallVec<A> where A::Item: Clone {
|
|||
}
|
||||
}
|
||||
|
||||
impl<A: Array> From<Vec<A::Item>> for SmallVec<A> {
|
||||
#[inline]
|
||||
fn from(vec: Vec<A::Item>) -> SmallVec<A> {
|
||||
SmallVec::from_vec(vec)
|
||||
}
|
||||
}
|
||||
|
||||
impl<A: Array> From<A> for SmallVec<A> {
|
||||
#[inline]
|
||||
fn from(array: A) -> SmallVec<A> {
|
||||
SmallVec::from_buf(array)
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! impl_index {
|
||||
($index_type: ty, $output_type: ty) => {
|
||||
impl<A: Array> ops::Index<$index_type> for SmallVec<A> {
|
||||
|
@ -825,6 +903,7 @@ impl<A: Array> ExtendFromSlice<A::Item> for SmallVec<A> where A::Item: Copy {
|
|||
}
|
||||
}
|
||||
|
||||
#[allow(deprecated)]
|
||||
impl<A: Array> VecLike<A::Item> for SmallVec<A> {
|
||||
#[inline]
|
||||
fn push(&mut self, value: A::Item) {
|
||||
|
@ -885,7 +964,7 @@ impl<A: Array> Drop for SmallVec<A> {
|
|||
|
||||
impl<A: Array> Clone for SmallVec<A> where A::Item: Clone {
|
||||
fn clone(&self) -> SmallVec<A> {
|
||||
let mut new_vector = SmallVec::new();
|
||||
let mut new_vector = SmallVec::with_capacity(self.len());
|
||||
for element in self.iter() {
|
||||
new_vector.push((*element).clone())
|
||||
}
|
||||
|
@ -925,6 +1004,11 @@ impl<A: Array> Hash for SmallVec<A> where A::Item: Hash {
|
|||
|
||||
unsafe impl<A: Array> Send for SmallVec<A> where A::Item: Send {}
|
||||
|
||||
/// An iterator that consumes a `SmallVec` and yields its items by value.
|
||||
///
|
||||
/// Returned from [`SmallVec::into_iter`][1].
|
||||
///
|
||||
/// [1]: struct.SmallVec.html#method.into_iter
|
||||
pub struct IntoIter<A: Array> {
|
||||
data: SmallVecData<A>,
|
||||
current: usize,
|
||||
|
@ -1012,41 +1096,15 @@ impl<'a, A: Array> IntoIterator for &'a mut SmallVec<A> {
|
|||
}
|
||||
}
|
||||
|
||||
// TODO: Remove these and its users.
|
||||
|
||||
/// Deprecated alias to ease transition from an earlier version.
|
||||
#[deprecated]
|
||||
pub type SmallVec1<T> = SmallVec<[T; 1]>;
|
||||
|
||||
/// Deprecated alias to ease transition from an earlier version.
|
||||
#[deprecated]
|
||||
pub type SmallVec2<T> = SmallVec<[T; 2]>;
|
||||
|
||||
/// Deprecated alias to ease transition from an earlier version.
|
||||
#[deprecated]
|
||||
pub type SmallVec4<T> = SmallVec<[T; 4]>;
|
||||
|
||||
/// Deprecated alias to ease transition from an earlier version.
|
||||
#[deprecated]
|
||||
pub type SmallVec8<T> = SmallVec<[T; 8]>;
|
||||
|
||||
/// Deprecated alias to ease transition from an earlier version.
|
||||
#[deprecated]
|
||||
pub type SmallVec16<T> = SmallVec<[T; 16]>;
|
||||
|
||||
/// Deprecated alias to ease transition from an earlier version.
|
||||
#[deprecated]
|
||||
pub type SmallVec24<T> = SmallVec<[T; 24]>;
|
||||
|
||||
/// Deprecated alias to ease transition from an earlier version.
|
||||
#[deprecated]
|
||||
pub type SmallVec32<T> = SmallVec<[T; 32]>;
|
||||
|
||||
/// Types that can be used as the backing store for a SmallVec
|
||||
pub unsafe trait Array {
|
||||
/// The type of the array's elements.
|
||||
type Item;
|
||||
/// Returns the number of items the array can hold.
|
||||
fn size() -> usize;
|
||||
/// Returns a pointer to the first element of the array.
|
||||
fn ptr(&self) -> *const Self::Item;
|
||||
/// Returns a mutable pointer to the first element of the array.
|
||||
fn ptr_mut(&mut self) -> *mut Self::Item;
|
||||
}
|
||||
|
||||
|
@ -1068,7 +1126,7 @@ impl_array!(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 20, 24, 32, 3
|
|||
0x10000, 0x20000, 0x40000, 0x80000, 0x100000);
|
||||
|
||||
#[cfg(test)]
|
||||
pub mod tests {
|
||||
mod tests {
|
||||
use SmallVec;
|
||||
|
||||
use std::iter::FromIterator;
|
||||
|
@ -1086,11 +1144,6 @@ pub mod tests {
|
|||
#[cfg(not(feature = "std"))]
|
||||
use alloc::vec::Vec;
|
||||
|
||||
#[cfg(feature="heapsizeof")]
|
||||
use heapsize::HeapSizeOf;
|
||||
#[cfg(feature="heapsizeof")]
|
||||
use std::mem::size_of;
|
||||
|
||||
// We heap allocate all these strings so that double frees will show up under valgrind.
|
||||
|
||||
#[test]
|
||||
|
@ -1156,6 +1209,19 @@ pub mod tests {
|
|||
assert!(Some(SmallVec::<[&u32; 2]>::new()).is_some());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_with_capacity() {
|
||||
let v: SmallVec<[u8; 3]> = SmallVec::with_capacity(1);
|
||||
assert!(v.is_empty());
|
||||
assert!(!v.spilled());
|
||||
assert_eq!(v.capacity(), 3);
|
||||
|
||||
let v: SmallVec<[u8; 3]> = SmallVec::with_capacity(10);
|
||||
assert!(v.is_empty());
|
||||
assert!(v.spilled());
|
||||
assert_eq!(v.capacity(), 10);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn drain() {
|
||||
let mut v: SmallVec<[u8; 2]> = SmallVec::new();
|
||||
|
@ -1505,6 +1571,31 @@ pub mod tests {
|
|||
fn test_from() {
|
||||
assert_eq!(&SmallVec::<[u32; 2]>::from(&[1][..])[..], [1]);
|
||||
assert_eq!(&SmallVec::<[u32; 2]>::from(&[1, 2, 3][..])[..], [1, 2, 3]);
|
||||
|
||||
let vec = vec![];
|
||||
let small_vec: SmallVec<[u8; 3]> = SmallVec::from(vec);
|
||||
assert_eq!(&*small_vec, &[]);
|
||||
drop(small_vec);
|
||||
|
||||
let vec = vec![1, 2, 3, 4, 5];
|
||||
let small_vec: SmallVec<[u8; 3]> = SmallVec::from(vec);
|
||||
assert_eq!(&*small_vec, &[1, 2, 3, 4, 5]);
|
||||
drop(small_vec);
|
||||
|
||||
let vec = vec![1, 2, 3, 4, 5];
|
||||
let small_vec: SmallVec<[u8; 1]> = SmallVec::from(vec);
|
||||
assert_eq!(&*small_vec, &[1, 2, 3, 4, 5]);
|
||||
drop(small_vec);
|
||||
|
||||
let array = [1];
|
||||
let small_vec: SmallVec<[u8; 1]> = SmallVec::from(array);
|
||||
assert_eq!(&*small_vec, &[1]);
|
||||
drop(small_vec);
|
||||
|
||||
let array = [99; 128];
|
||||
let small_vec: SmallVec<[u8; 128]> = SmallVec::from(array);
|
||||
assert_eq!(&*small_vec, vec![99u8; 128].as_slice());
|
||||
drop(small_vec);
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -1513,30 +1604,6 @@ pub mod tests {
|
|||
assert_eq!(&SmallVec::<[u32; 2]>::from_slice(&[1, 2, 3][..])[..], [1, 2, 3]);
|
||||
}
|
||||
|
||||
#[cfg(feature="heapsizeof")]
|
||||
#[test]
|
||||
fn test_heap_size_of_children() {
|
||||
let mut vec = SmallVec::<[u32; 2]>::new();
|
||||
assert_eq!(vec.heap_size_of_children(), 0);
|
||||
vec.push(1);
|
||||
vec.push(2);
|
||||
assert_eq!(vec.heap_size_of_children(), 0);
|
||||
vec.push(3);
|
||||
assert_eq!(vec.heap_size_of_children(), 16);
|
||||
|
||||
// Now check with reserved space
|
||||
let mut vec = SmallVec::<[u32; 2]>::new();
|
||||
vec.reserve(10); // Rounds up to 16
|
||||
assert_eq!(vec.heap_size_of_children(), 64);
|
||||
|
||||
// Check with nested heap structures
|
||||
let mut vec = SmallVec::<[Vec<u32>; 2]>::new();
|
||||
vec.reserve(10);
|
||||
vec.push(vec![2, 3, 4]);
|
||||
assert_eq!(vec.heap_size_of_children(),
|
||||
vec![2, 3, 4].heap_size_of_children() + 16 * size_of::<Vec<u32>>());
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_exact_size_iterator() {
|
||||
let mut vec = SmallVec::<[u32; 2]>::from(&[1, 2, 3][..]);
|
||||
|
@ -1545,6 +1612,7 @@ pub mod tests {
|
|||
}
|
||||
|
||||
#[test]
|
||||
#[allow(deprecated)]
|
||||
fn veclike_deref_slice() {
|
||||
use super::VecLike;
|
||||
|
||||
|
@ -1615,7 +1683,7 @@ pub mod tests {
|
|||
fn test_retain() {
|
||||
// Test inline data storate
|
||||
let mut sv: SmallVec<[i32; 5]> = SmallVec::from_slice(&[1, 2, 3, 3, 4]);
|
||||
sv.retain(|&i| i != 3);
|
||||
sv.retain(|&mut i| i != 3);
|
||||
assert_eq!(sv.pop(), Some(4));
|
||||
assert_eq!(sv.pop(), Some(2));
|
||||
assert_eq!(sv.pop(), Some(1));
|
||||
|
@ -1623,7 +1691,7 @@ pub mod tests {
|
|||
|
||||
// Test spilled data storage
|
||||
let mut sv: SmallVec<[i32; 3]> = SmallVec::from_slice(&[1, 2, 3, 3, 4]);
|
||||
sv.retain(|&i| i != 3);
|
||||
sv.retain(|&mut i| i != 3);
|
||||
assert_eq!(sv.pop(), Some(4));
|
||||
assert_eq!(sv.pop(), Some(2));
|
||||
assert_eq!(sv.pop(), Some(1));
|
||||
|
@ -1646,6 +1714,25 @@ pub mod tests {
|
|||
assert_eq!(Rc::strong_count(&one), 1);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_dedup() {
|
||||
let mut dupes: SmallVec<[i32; 5]> = SmallVec::from_slice(&[1, 1, 2, 3, 3]);
|
||||
dupes.dedup();
|
||||
assert_eq!(&*dupes, &[1, 2, 3]);
|
||||
|
||||
let mut empty: SmallVec<[i32; 5]> = SmallVec::new();
|
||||
empty.dedup();
|
||||
assert!(empty.is_empty());
|
||||
|
||||
let mut all_ones: SmallVec<[i32; 5]> = SmallVec::from_slice(&[1, 1, 1, 1, 1]);
|
||||
all_ones.dedup();
|
||||
assert_eq!(all_ones.len(), 1);
|
||||
|
||||
let mut no_dupes: SmallVec<[i32; 5]> = SmallVec::from_slice(&[1, 2, 3, 4, 5]);
|
||||
no_dupes.dedup();
|
||||
assert_eq!(no_dupes.len(), 5);
|
||||
}
|
||||
|
||||
#[cfg(feature = "std")]
|
||||
#[test]
|
||||
fn test_write() {
|
||||
|
@ -1663,6 +1750,7 @@ pub mod tests {
|
|||
assert_eq!(small_vec.as_ref(), data.as_ref());
|
||||
}
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
extern crate bincode;
|
||||
|
||||
#[cfg(feature = "serde")]
|
||||
|
|
|
@ -282,7 +282,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cssparser"
|
||||
version = "0.22.0"
|
||||
version = "0.23.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cssparser-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -292,7 +292,7 @@ dependencies = [
|
|||
"phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"procedural-masquerade 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -538,7 +538,7 @@ name = "geckoservo"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -741,7 +741,7 @@ name = "malloc_size_of"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"app_units 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.15.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hashglobe 0.1.0",
|
||||
"servo_arc 0.0.1",
|
||||
|
@ -1145,7 +1145,7 @@ name = "selectors"
|
|||
version = "0.19.0"
|
||||
dependencies = [
|
||||
"bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"malloc_size_of 0.0.1",
|
||||
|
@ -1231,6 +1231,11 @@ name = "smallvec"
|
|||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "stable_deref_trait"
|
||||
version = "1.0.0"
|
||||
|
@ -1252,7 +1257,7 @@ dependencies = [
|
|||
"bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.15.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fallible 0.0.1",
|
||||
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1305,7 +1310,7 @@ version = "0.0.1"
|
|||
dependencies = [
|
||||
"app_units 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.15.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"malloc_size_of 0.0.1",
|
||||
"malloc_size_of_derive 0.0.1",
|
||||
|
@ -1617,7 +1622,7 @@ dependencies = [
|
|||
"checksum core-text 8.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bcad23756dd1dc4b47bf6a914ace27aadb8fa68889db5837af2308d018d0467c"
|
||||
"checksum cose 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ec10816629f38fa557f08e199a3474fab954f4c8d2645550367235afa6e5646b"
|
||||
"checksum cose-c 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "07cc8bb85ec2e93541ef9369b85a4b6fb7732bc7f4854d317eab20e726b0fc2f"
|
||||
"checksum cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44313341610282488e1156ad1fedebca51c54766c87a041d0287b10499c04ba1"
|
||||
"checksum cssparser 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8a807ac3ab7a217829c2a3b65732b926b2befe6a35f33b4bf8b503692430f223"
|
||||
"checksum cssparser-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "079adec4af52bb5275eadd004292028c79eb3c5f5b4ee8086a36d4197032f6df"
|
||||
"checksum darling 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9861a8495606435477df581bc858ccf15a3469747edf175b94a4704fd9aaedac"
|
||||
"checksum darling_core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1486a8b00b45062c997f767738178b43219133dd0c8c826cb811e60563810821"
|
||||
|
@ -1706,6 +1711,7 @@ dependencies = [
|
|||
"checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23"
|
||||
"checksum smallbitvec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "79b776f00dfe01df905fa3b2eaa1659522e99e3fc4a7b1334171622205c4bdcf"
|
||||
"checksum smallvec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8fcd03faf178110ab0334d74ca9631d77f94c8c11cc77fcb59538abf0025695d"
|
||||
"checksum smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44db0ecb22921ef790d17ae13a3f6d15784183ff5f2a01aa32098c7498d2b4b9"
|
||||
"checksum stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "15132e0e364248108c5e2c02e3ab539be8d6f5d52a01ca9bbf27ed657316f02b"
|
||||
"checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694"
|
||||
"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
|
||||
|
|
|
@ -282,7 +282,7 @@ dependencies = [
|
|||
|
||||
[[package]]
|
||||
name = "cssparser"
|
||||
version = "0.22.0"
|
||||
version = "0.23.2"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
dependencies = [
|
||||
"cssparser-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -292,7 +292,7 @@ dependencies = [
|
|||
"phf 0.7.21 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"procedural-masquerade 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"quote 0.3.15 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
]
|
||||
|
||||
|
@ -538,7 +538,7 @@ name = "geckoservo"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"libc 0.2.24 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -740,7 +740,7 @@ name = "malloc_size_of"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"app_units 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.15.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"hashglobe 0.1.0",
|
||||
"servo_arc 0.0.1",
|
||||
|
@ -1133,7 +1133,7 @@ name = "selectors"
|
|||
version = "0.19.0"
|
||||
dependencies = [
|
||||
"bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"log 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"malloc_size_of 0.0.1",
|
||||
|
@ -1223,6 +1223,11 @@ name = "smallvec"
|
|||
version = "0.4.3"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "smallvec"
|
||||
version = "0.6.0"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
|
||||
[[package]]
|
||||
name = "stable_deref_trait"
|
||||
version = "1.0.0"
|
||||
|
@ -1244,7 +1249,7 @@ dependencies = [
|
|||
"bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"byteorder 1.2.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cfg-if 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.15.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"fallible 0.0.1",
|
||||
"fnv 1.0.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
|
@ -1297,7 +1302,7 @@ version = "0.0.1"
|
|||
dependencies = [
|
||||
"app_units 0.5.6 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"bitflags 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.15.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"malloc_size_of 0.0.1",
|
||||
"malloc_size_of_derive 0.0.1",
|
||||
|
@ -1310,7 +1315,7 @@ name = "stylo_tests"
|
|||
version = "0.0.1"
|
||||
dependencies = [
|
||||
"atomic_refcell 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"cssparser 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"env_logger 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"euclid 0.15.5 (registry+https://github.com/rust-lang/crates.io-index)",
|
||||
"geckoservo 0.0.1",
|
||||
|
@ -1629,7 +1634,7 @@ dependencies = [
|
|||
"checksum core-text 8.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "bcad23756dd1dc4b47bf6a914ace27aadb8fa68889db5837af2308d018d0467c"
|
||||
"checksum cose 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "ec10816629f38fa557f08e199a3474fab954f4c8d2645550367235afa6e5646b"
|
||||
"checksum cose-c 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)" = "07cc8bb85ec2e93541ef9369b85a4b6fb7732bc7f4854d317eab20e726b0fc2f"
|
||||
"checksum cssparser 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44313341610282488e1156ad1fedebca51c54766c87a041d0287b10499c04ba1"
|
||||
"checksum cssparser 0.23.2 (registry+https://github.com/rust-lang/crates.io-index)" = "8a807ac3ab7a217829c2a3b65732b926b2befe6a35f33b4bf8b503692430f223"
|
||||
"checksum cssparser-macros 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "079adec4af52bb5275eadd004292028c79eb3c5f5b4ee8086a36d4197032f6df"
|
||||
"checksum darling 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "9861a8495606435477df581bc858ccf15a3469747edf175b94a4704fd9aaedac"
|
||||
"checksum darling_core 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1486a8b00b45062c997f767738178b43219133dd0c8c826cb811e60563810821"
|
||||
|
@ -1718,6 +1723,7 @@ dependencies = [
|
|||
"checksum slab 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "17b4fcaed89ab08ef143da37bc52adbcc04d4a69014f4c1208d6b51f0c47bc23"
|
||||
"checksum smallbitvec 1.0.6 (registry+https://github.com/rust-lang/crates.io-index)" = "79b776f00dfe01df905fa3b2eaa1659522e99e3fc4a7b1334171622205c4bdcf"
|
||||
"checksum smallvec 0.4.3 (registry+https://github.com/rust-lang/crates.io-index)" = "8fcd03faf178110ab0334d74ca9631d77f94c8c11cc77fcb59538abf0025695d"
|
||||
"checksum smallvec 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "44db0ecb22921ef790d17ae13a3f6d15784183ff5f2a01aa32098c7498d2b4b9"
|
||||
"checksum stable_deref_trait 1.0.0 (registry+https://github.com/rust-lang/crates.io-index)" = "15132e0e364248108c5e2c02e3ab539be8d6f5d52a01ca9bbf27ed657316f02b"
|
||||
"checksum strsim 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "b4d15c810519a91cf877e7e36e63fe068815c678181439f2f29e2562147c3694"
|
||||
"checksum syn 0.11.11 (registry+https://github.com/rust-lang/crates.io-index)" = "d3b891b9015c88c576343b9b3e41c2c11a51c219ef067b264bd9c8aa9b441dad"
|
||||
|
|
Загрузка…
Ссылка в новой задаче