[librsvg: 1/3] Swap SmallVec for TinyVec
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 1/3] Swap SmallVec for TinyVec
- Date: Wed, 1 Apr 2020 19:48:25 +0000 (UTC)
commit bee0d172aff8ade667a2b0c8c7fadb2922599c9f
Author: Sergey "Shnatsel" Davidoff <sdavydov google com>
Date: Sat Mar 28 21:17:47 2020 +0100
Swap SmallVec for TinyVec
Cargo.lock | 8 +++++++-
rsvg_internals/Cargo.toml | 2 +-
rsvg_internals/src/path_builder.rs | 12 +++++++++---
3 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/Cargo.lock b/Cargo.lock
index f1dd3655..882ef61c 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -1366,7 +1366,7 @@ dependencies = [
"rctree 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"regex 1.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
"selectors 0.22.0 (registry+https://github.com/rust-lang/crates.io-index)",
- "smallvec 1.2.0 (registry+https://github.com/rust-lang/crates.io-index)",
+ "tinyvec 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)",
"url 2.1.1 (registry+https://github.com/rust-lang/crates.io-index)",
"xml-rs 0.8.0 (registry+https://github.com/rust-lang/crates.io-index)",
]
@@ -1582,6 +1582,11 @@ dependencies = [
"serde_json 1.0.47 (registry+https://github.com/rust-lang/crates.io-index)",
]
+[[package]]
+name = "tinyvec"
+version = "0.3.3"
+source = "registry+https://github.com/rust-lang/crates.io-index"
+
[[package]]
name = "treeline"
version = "0.1.0"
@@ -1855,6 +1860,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum thread_local 1.0.1 (registry+https://github.com/rust-lang/crates.io-index)" =
"d40c6d1b69745a6ec6fb1ca717914848da4b44ae29d9b3080cbee91d72a69b14"
"checksum time 0.1.42 (registry+https://github.com/rust-lang/crates.io-index)" =
"db8dcfca086c1143c9270ac42a2bbd8a7ee477b78ac8e45b19abfb0cbede4b6f"
"checksum tinytemplate 1.0.3 (registry+https://github.com/rust-lang/crates.io-index)" =
"57a3c6667d3e65eb1bc3aed6fd14011c6cbc3a0665218ab7f5daf040b9ec371a"
+"checksum tinyvec 0.3.3 (registry+https://github.com/rust-lang/crates.io-index)" =
"53953d2d3a5ad81d9f844a32f14ebb121f50b650cd59d0ee2a07cf13c617efed"
"checksum treeline 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)" =
"a7f741b240f1a48843f9b8e0444fb55fb2a4ff67293b50a9179dfd5ea67f8d41"
"checksum typenum 1.11.2 (registry+https://github.com/rust-lang/crates.io-index)" =
"6d2783fe2d6b8c1101136184eb41be8b1ad379e4657050b8aaff0c79ee7575f9"
"checksum unicode-bidi 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)" =
"49f2bd0c6468a8230e1db229cff8029217cf623c767ea5d60bfbd42729ea54d5"
diff --git a/rsvg_internals/Cargo.toml b/rsvg_internals/Cargo.toml
index 6943e443..aba6a5c8 100644
--- a/rsvg_internals/Cargo.toml
+++ b/rsvg_internals/Cargo.toml
@@ -35,7 +35,7 @@ rayon = "1"
rctree = "0.3.3"
regex = "1"
selectors = "0.22.0"
-smallvec = "1.2.0"
+tinyvec = {version = "0.3.2", features = ["alloc"]}
url = "2"
xml-rs = "0.8.0"
diff --git a/rsvg_internals/src/path_builder.rs b/rsvg_internals/src/path_builder.rs
index 464e5a94..2a56d66a 100644
--- a/rsvg_internals/src/path_builder.rs
+++ b/rsvg_internals/src/path_builder.rs
@@ -1,6 +1,6 @@
//! Representation of Bézier paths.
-use smallvec::SmallVec;
+use tinyvec::TinyVec;
use std::f64;
use std::f64::consts::*;
@@ -332,6 +332,12 @@ pub enum PathCommand {
ClosePath,
}
+impl Default for PathCommand {
+ fn default() -> Self {
+ PathCommand::ClosePath
+ }
+}
+
impl PathCommand {
fn to_cairo(&self, cr: &cairo::Context) {
match *self {
@@ -427,7 +433,7 @@ impl PathCommand {
/// a `Path` with `into_path`.
#[derive(Clone)]
pub struct PathBuilder {
- path_commands: SmallVec<[PathCommand; 32]>,
+ path_commands: TinyVec<[PathCommand; 32]>,
}
/// An immutable path with a compact representation.
@@ -471,7 +477,7 @@ enum PackedCommand {
impl PathBuilder {
pub fn new() -> PathBuilder {
PathBuilder {
- path_commands: SmallVec::new(),
+ path_commands: TinyVec::new(),
}
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]