Bug 1716518 - Upgrade app_units to v0.7.1. r=emilio

Differential Revision: https://phabricator.services.mozilla.com/D117756
This commit is contained in:
Mike Hommey 2021-06-15 20:39:46 +00:00
Родитель 2c1e53b8e4
Коммит 6cb7570ca3
5 изменённых файлов: 19 добавлений и 4 удалений

4
Cargo.lock сгенерированный
Просмотреть файл

@ -54,9 +54,9 @@ dependencies = [
[[package]] [[package]]
name = "app_units" name = "app_units"
version = "0.7.0" version = "0.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index" source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9dadc668390b373e73e4abbfc1f07238b09a25858f2f39c06cebc6d8e141d774" checksum = "fc3ec9d4c47b25a5a9e5c848e053640331c7cedb1637434d75db68b79fee8a7f"
dependencies = [ dependencies = [
"num-traits", "num-traits",
"serde", "serde",

Просмотреть файл

@ -1 +1 @@
{"files":{"Cargo.toml":"2b57a8f3f88b35e6ea03b563b2127fe01b90c5d2102910dfb662584e9d72ad26","README.md":"2f4c2188cdcfaa201ecd7c6b1bdb5247a54b534fc50a4e26b339a245cee973a9","src/app_unit.rs":"ab0df325046c8d012202a6a4ec54bbca961aed80529c5cbab4c4c837046a7bf8","src/lib.rs":"594920680604545eed486e6891b9b7d52d3baee3b2d774687fc0ac244331edf5"},"package":"9dadc668390b373e73e4abbfc1f07238b09a25858f2f39c06cebc6d8e141d774"} {"files":{"Cargo.toml":"ddda3a177dfcad875318bf1dfeb28183e60e9cf5b81944238f281626c113d666","README.md":"2f4c2188cdcfaa201ecd7c6b1bdb5247a54b534fc50a4e26b339a245cee973a9","src/app_unit.rs":"0cd350eeb0926bef7979773fb0114d6d4177366a9f5722f20ff45215b0f3526e","src/lib.rs":"97452b7741d623f09dfa9d4f4dc4958f3554ca0c04980799534e7afbe16342bd"},"package":"fc3ec9d4c47b25a5a9e5c848e053640331c7cedb1637434d75db68b79fee8a7f"}

9
third_party/rust/app_units/Cargo.toml поставляемый
Просмотреть файл

@ -12,7 +12,7 @@
[package] [package]
name = "app_units" name = "app_units"
version = "0.7.0" version = "0.7.1"
authors = ["The Servo Project Developers"] authors = ["The Servo Project Developers"]
description = "Servo app units type (Au)" description = "Servo app units type (Au)"
documentation = "https://docs.rs/app_units/" documentation = "https://docs.rs/app_units/"
@ -20,6 +20,13 @@ license = "MPL-2.0"
repository = "https://github.com/servo/app_units" repository = "https://github.com/servo/app_units"
[dependencies.num-traits] [dependencies.num-traits]
version = "0.2" version = "0.2"
optional = true
[dependencies.serde] [dependencies.serde]
version = "1.0" version = "1.0"
optional = true
[features]
default = ["num_traits", "serde_serialization"]
num_traits = ["num-traits"]
serde_serialization = ["serde"]

6
third_party/rust/app_units/src/app_unit.rs поставляемый
Просмотреть файл

@ -2,8 +2,11 @@
* License, v. 2.0. If a copy of the MPL was not distributed with this * 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/. */ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
#[cfg(feature = "num_traits")]
use num_traits::Zero; use num_traits::Zero;
#[cfg(feature = "serde_serialization")]
use serde::de::{Deserialize, Deserializer}; use serde::de::{Deserialize, Deserializer};
#[cfg(feature = "serde_serialization")]
use serde::ser::{Serialize, Serializer}; use serde::ser::{Serialize, Serializer};
use std::default::Default; use std::default::Default;
use std::fmt; use std::fmt;
@ -22,12 +25,14 @@ pub const AU_PER_PX: i32 = 60;
/// panics and overflows. /// panics and overflows.
pub struct Au(pub i32); pub struct Au(pub i32);
#[cfg(feature = "serde_serialization")]
impl<'de> Deserialize<'de> for Au { impl<'de> Deserialize<'de> for Au {
fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Au, D::Error> { fn deserialize<D: Deserializer<'de>>(deserializer: D) -> Result<Au, D::Error> {
Ok(Au(try!(i32::deserialize(deserializer))).clamp()) Ok(Au(try!(i32::deserialize(deserializer))).clamp())
} }
} }
#[cfg(feature = "serde_serialization")]
impl Serialize for Au { impl Serialize for Au {
fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> { fn serialize<S: Serializer>(&self, serializer: S) -> Result<S::Ok, S::Error> {
self.0.serialize(serializer) self.0.serialize(serializer)
@ -41,6 +46,7 @@ impl Default for Au {
} }
} }
#[cfg(feature = "num_traits")]
impl Zero for Au { impl Zero for Au {
#[inline] #[inline]
fn zero() -> Au { fn zero() -> Au {

2
third_party/rust/app_units/src/lib.rs поставляемый
Просмотреть файл

@ -6,7 +6,9 @@
//! originally proposed in 2002 as a standard unit of measure in Gecko. //! originally proposed in 2002 as a standard unit of measure in Gecko.
//! See <https://bugzilla.mozilla.org/show_bug.cgi?id=177805> for more info. //! See <https://bugzilla.mozilla.org/show_bug.cgi?id=177805> for more info.
#[cfg(feature = "num_traits")]
extern crate num_traits; extern crate num_traits;
#[cfg(feature = "serde_serialization")]
extern crate serde; extern crate serde;
mod app_unit; mod app_unit;