Codebase list rust-stfu8 / d05fcc5
Unbreak rust-euclid-0.19 (drop euclid_macros) Andrej Shadura 4 years ago
7 changed file(s) with 1260 addition(s) and 106 deletion(s). Raw diff Collapse all Expand all
0 rust-euclid-0.19 (0.19.9-3) UNRELEASED-FIXME-AUTOGENERATED-DEBCARGO; urgency=medium
1
2 * Package euclid 0.19.9 from crates.io using debcargo 2.2.10
3
4 -- Andrej Shadura <andrewsh@debian.org> Sun, 27 Oct 2019 22:06:06 +0100
5
06 rust-euclid-0.19 (0.19.9-2) unstable; urgency=medium
17
28 * Rebuild package euclid 0.19.9 from crates.io using debcargo 2.2.10
0 From d0a3d71caa2bf5e4b3ca9e9d1ea1b3ca15e67271 Mon Sep 17 00:00:00 2001
1 From: Nicolas Silva <nical@fastmail.com>
2 Date: Wed, 19 Jun 2019 13:43:15 -0700
3 Subject: [PATCH] Remove euclid_macros.
4
5 This makes euclid much faster to build with default features.
6 ---
7 Cargo.toml | 3 +-
8 macros/Cargo.toml | 15 ---
9 macros/LICENSE-APACHE | 201 --------------------------------
10 macros/LICENSE-MIT | 25 ----
11 macros/euclid_matrix.rs | 247 ----------------------------------------
12 macros/lib.rs | 16 ---
13 src/homogen.rs | 62 +++++++++-
14 src/lib.rs | 2 -
15 src/point.rs | 116 ++++++++++++++++++-
16 src/rotation.rs | 119 ++++++++++++++++++-
17 src/side_offsets.rs | 66 ++++++++++-
18 src/size.rs | 116 ++++++++++++++++++-
19 src/transform2d.rs | 85 +++++++++++++-
20 src/transform3d.rs | 118 ++++++++++++++++++-
21 src/translation.rs | 116 ++++++++++++++++++-
22 src/vector.rs | 116 ++++++++++++++++++-
23 16 files changed, 901 insertions(+), 522 deletions(-)
24 delete mode 100644 macros/Cargo.toml
25 delete mode 100644 macros/LICENSE-APACHE
26 delete mode 100644 macros/LICENSE-MIT
27 delete mode 100644 macros/euclid_matrix.rs
28 delete mode 100644 macros/lib.rs
29
30 diff --git a/Cargo.toml b/Cargo.toml
31 index 146e12a..57b86e3 100644
32 --- a/Cargo.toml
33 +++ b/Cargo.toml
34 @@ -20,8 +20,6 @@
35 categories = ["science"]
36 license = "MIT / Apache-2.0"
37 repository = "https://github.com/servo/euclid"
38 -[dependencies.euclid_macros]
39 -version = "0.1"
40
41 [dependencies.mint]
42 version = "0.5.1"
43 diff --git a/src/homogen.rs b/src/homogen.rs
44 index 29a5073..2229115 100644
45 --- a/src/homogen.rs
46 +++ b/src/homogen.rs
47 @@ -15,10 +15,13 @@ use num::{One, Zero};
48 use core::fmt;
49 use core::marker::PhantomData;
50 use core::ops::Div;
51 +use core::cmp::{Eq, PartialEq};
52 +use core::hash::{Hash};
53 +#[cfg(feature = "serde")]
54 +use serde;
55
56
57 /// Homogeneous vector in 3D space.
58 -#[derive(EuclidMatrix)]
59 #[repr(C)]
60 pub struct HomogeneousVector<T, U> {
61 pub x: T,
62 @@ -29,6 +32,63 @@ pub struct HomogeneousVector<T, U> {
63 pub _unit: PhantomData<U>,
64 }
65
66 +impl<T: Copy, U> Copy for HomogeneousVector<T, U> {}
67 +
68 +impl<T: Clone, U> Clone for HomogeneousVector<T, U> {
69 + fn clone(&self) -> Self {
70 + HomogeneousVector {
71 + x: self.x.clone(),
72 + y: self.y.clone(),
73 + z: self.z.clone(),
74 + w: self.w.clone(),
75 + _unit: PhantomData,
76 + }
77 + }
78 +}
79 +
80 +#[cfg(feature = "serde")]
81 +impl<'de, T, U> serde::Deserialize<'de> for HomogeneousVector<T, U>
82 + where T: serde::Deserialize<'de>
83 +{
84 + fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
85 + where D: serde::Deserializer<'de>
86 + {
87 + let (x, y, z, w) = try!(serde::Deserialize::deserialize(deserializer));
88 + Ok(HomogeneousVector { x, y, z, w, _unit: PhantomData })
89 + }
90 +}
91 +
92 +#[cfg(feature = "serde")]
93 +impl<T, U> serde::Serialize for HomogeneousVector<T, U>
94 + where T: serde::Serialize
95 +{
96 + fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
97 + where S: serde::Serializer
98 + {
99 + (&self.x, &self.y, &self.z, &self.w).serialize(serializer)
100 + }
101 +}
102 +
103 +impl<T, U> Eq for HomogeneousVector<T, U> where T: Eq {}
104 +
105 +impl<T, U> PartialEq for HomogeneousVector<T, U>
106 + where T: PartialEq
107 +{
108 + fn eq(&self, other: &Self) -> bool {
109 + self.x == other.x && self.y == other.y && self.z == other.z && self.w == other.w
110 + }
111 +}
112 +
113 +impl<T, U> Hash for HomogeneousVector<T, U>
114 + where T: Hash
115 +{
116 + fn hash<H: ::core::hash::Hasher>(&self, h: &mut H) {
117 + self.x.hash(h);
118 + self.y.hash(h);
119 + self.z.hash(h);
120 + self.w.hash(h);
121 + }
122 +}
123
124 impl<T, U> HomogeneousVector<T, U> {
125 /// Constructor taking scalar values directly.
126 diff --git a/src/lib.rs b/src/lib.rs
127 index f604ab8..cc4ab6a 100644
128 --- a/src/lib.rs
129 +++ b/src/lib.rs
130 @@ -62,8 +62,6 @@ extern crate serde;
131
132 #[cfg(feature = "mint")]
133 pub extern crate mint;
134 -#[macro_use]
135 -extern crate euclid_macros;
136 extern crate num_traits;
137 #[cfg(test)]
138 extern crate rand;
139 diff --git a/src/point.rs b/src/point.rs
140 index dc8debb..f77eb56 100644
141 --- a/src/point.rs
142 +++ b/src/point.rs
143 @@ -20,9 +20,12 @@ use vector::{TypedVector2D, TypedVector3D, vec2, vec3};
144 use core::fmt;
145 use core::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Sub, SubAssign};
146 use core::marker::PhantomData;
147 +use core::cmp::{Eq, PartialEq};
148 +use core::hash::{Hash};
149 +#[cfg(feature = "serde")]
150 +use serde;
151
152 /// A 2d Point tagged with a unit.
153 -#[derive(EuclidMatrix)]
154 #[repr(C)]
155 pub struct TypedPoint2D<T, U> {
156 pub x: T,
157 @@ -31,6 +34,60 @@ pub struct TypedPoint2D<T, U> {
158 pub _unit: PhantomData<U>,
159 }
160
161 +impl<T: Copy, U> Copy for TypedPoint2D<T, U> {}
162 +
163 +impl<T: Clone, U> Clone for TypedPoint2D<T, U> {
164 + fn clone(&self) -> Self {
165 + TypedPoint2D {
166 + x: self.x.clone(),
167 + y: self.y.clone(),
168 + _unit: PhantomData,
169 + }
170 + }
171 +}
172 +
173 +#[cfg(feature = "serde")]
174 +impl<'de, T, U> serde::Deserialize<'de> for TypedPoint2D<T, U>
175 + where T: serde::Deserialize<'de>
176 +{
177 + fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
178 + where D: serde::Deserializer<'de>
179 + {
180 + let (x, y) = try!(serde::Deserialize::deserialize(deserializer));
181 + Ok(TypedPoint2D { x, y, _unit: PhantomData })
182 + }
183 +}
184 +
185 +#[cfg(feature = "serde")]
186 +impl<T, U> serde::Serialize for TypedPoint2D<T, U>
187 + where T: serde::Serialize
188 +{
189 + fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
190 + where S: serde::Serializer
191 + {
192 + (&self.x, &self.y).serialize(serializer)
193 + }
194 +}
195 +
196 +impl<T, U> Eq for TypedPoint2D<T, U> where T: Eq {}
197 +
198 +impl<T, U> PartialEq for TypedPoint2D<T, U>
199 + where T: PartialEq
200 +{
201 + fn eq(&self, other: &Self) -> bool {
202 + self.x == other.x && self.y == other.y
203 + }
204 +}
205 +
206 +impl<T, U> Hash for TypedPoint2D<T, U>
207 + where T: Hash
208 +{
209 + fn hash<H: ::core::hash::Hasher>(&self, h: &mut H) {
210 + self.x.hash(h);
211 + self.y.hash(h);
212 + }
213 +}
214 +
215 mint_vec!(TypedPoint2D[x, y] = Point2);
216
217 /// Default 2d point type with no unit.
218 @@ -435,7 +492,6 @@ impl<T: Copy, U> From<(T, T)> for TypedPoint2D<T, U> {
219 }
220
221 /// A 3d Point tagged with a unit.
222 -#[derive(EuclidMatrix)]
223 #[repr(C)]
224 pub struct TypedPoint3D<T, U> {
225 pub x: T,
226 @@ -447,6 +503,62 @@ pub struct TypedPoint3D<T, U> {
227
228 mint_vec!(TypedPoint3D[x, y, z] = Point3);
229
230 +impl<T: Copy, U> Copy for TypedPoint3D<T, U> {}
231 +
232 +impl<T: Clone, U> Clone for TypedPoint3D<T, U> {
233 + fn clone(&self) -> Self {
234 + TypedPoint3D {
235 + x: self.x.clone(),
236 + y: self.y.clone(),
237 + z: self.z.clone(),
238 + _unit: PhantomData,
239 + }
240 + }
241 +}
242 +
243 +#[cfg(feature = "serde")]
244 +impl<'de, T, U> serde::Deserialize<'de> for TypedPoint3D<T, U>
245 + where T: serde::Deserialize<'de>
246 +{
247 + fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
248 + where D: serde::Deserializer<'de>
249 + {
250 + let (x, y, z) = try!(serde::Deserialize::deserialize(deserializer));
251 + Ok(TypedPoint3D { x, y, z, _unit: PhantomData })
252 + }
253 +}
254 +
255 +#[cfg(feature = "serde")]
256 +impl<T, U> serde::Serialize for TypedPoint3D<T, U>
257 + where T: serde::Serialize
258 +{
259 + fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
260 + where S: serde::Serializer
261 + {
262 + (&self.x, &self.y, &self.z).serialize(serializer)
263 + }
264 +}
265 +
266 +impl<T, U> Eq for TypedPoint3D<T, U> where T: Eq {}
267 +
268 +impl<T, U> PartialEq for TypedPoint3D<T, U>
269 + where T: PartialEq
270 +{
271 + fn eq(&self, other: &Self) -> bool {
272 + self.x == other.x && self.y == other.y && self.z == other.z
273 + }
274 +}
275 +
276 +impl<T, U> Hash for TypedPoint3D<T, U>
277 + where T: Hash
278 +{
279 + fn hash<H: ::core::hash::Hasher>(&self, h: &mut H) {
280 + self.x.hash(h);
281 + self.y.hash(h);
282 + self.z.hash(h);
283 + }
284 +}
285 +
286 /// Default 3d point type with no unit.
287 ///
288 /// `Point3D` provides the same methods as `TypedPoint3D`.
289 diff --git a/src/rotation.rs b/src/rotation.rs
290 index 29f021f..a213c70 100644
291 --- a/src/rotation.rs
292 +++ b/src/rotation.rs
293 @@ -12,9 +12,13 @@ use num_traits::{Float, FloatConst, One, Zero, NumCast};
294 use core::fmt;
295 use core::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Rem, Sub, SubAssign};
296 use core::marker::PhantomData;
297 +use core::cmp::{Eq, PartialEq};
298 +use core::hash::{Hash};
299 use trig::Trig;
300 use {TypedPoint2D, TypedPoint3D, TypedVector2D, TypedVector3D, Vector3D, point2, point3, vec3};
301 use {TypedTransform2D, TypedTransform3D, UnknownUnit};
302 +#[cfg(feature = "serde")]
303 +use serde;
304
305 /// An angle in radians
306 #[derive(Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Hash)]
307 @@ -186,7 +190,6 @@ impl<T: Neg<Output = T>> Neg for Angle<T> {
308 }
309
310 /// A transform that can represent rotations in 2d, represented as an angle in radians.
311 -#[derive(EuclidMatrix)]
312 #[repr(C)]
313 pub struct TypedRotation2D<T, Src, Dst> {
314 pub angle : T,
315 @@ -197,6 +200,58 @@ pub struct TypedRotation2D<T, Src, Dst> {
316 /// The default 2d rotation type with no units.
317 pub type Rotation2D<T> = TypedRotation2D<T, UnknownUnit, UnknownUnit>;
318
319 +impl<T: Copy, Src, Dst> Copy for TypedRotation2D<T, Src, Dst> {}
320 +
321 +impl<T: Clone, Src, Dst> Clone for TypedRotation2D<T, Src, Dst> {
322 + fn clone(&self) -> Self {
323 + TypedRotation2D {
324 + angle: self.angle.clone(),
325 + _unit: PhantomData,
326 + }
327 + }
328 +}
329 +
330 +#[cfg(feature = "serde")]
331 +impl<'de, T, Src, Dst> serde::Deserialize<'de> for TypedRotation2D<T, Src, Dst>
332 + where T: serde::Deserialize<'de>
333 +{
334 + fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
335 + where D: serde::Deserializer<'de>
336 + {
337 + let (angle,) = try!(serde::Deserialize::deserialize(deserializer));
338 + Ok(TypedRotation2D { angle, _unit: PhantomData })
339 + }
340 +}
341 +
342 +#[cfg(feature = "serde")]
343 +impl<T, Src, Dst> serde::Serialize for TypedRotation2D<T, Src, Dst>
344 + where T: serde::Serialize
345 +{
346 + fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
347 + where S: serde::Serializer
348 + {
349 + (&self.angle,).serialize(serializer)
350 + }
351 +}
352 +
353 +impl<T, Src, Dst> Eq for TypedRotation2D<T, Src, Dst> where T: Eq {}
354 +
355 +impl<T, Src, Dst> PartialEq for TypedRotation2D<T, Src, Dst>
356 + where T: PartialEq
357 +{
358 + fn eq(&self, other: &Self) -> bool {
359 + self.angle == other.angle
360 + }
361 +}
362 +
363 +impl<T, Src, Dst> Hash for TypedRotation2D<T, Src, Dst>
364 + where T: Hash
365 +{
366 + fn hash<H: ::core::hash::Hasher>(&self, h: &mut H) {
367 + self.angle.hash(h);
368 + }
369 +}
370 +
371 impl<T, Src, Dst> TypedRotation2D<T, Src, Dst> {
372 #[inline]
373 /// Creates a rotation from an angle in radians.
374 @@ -322,7 +377,6 @@ where
375 /// Some people use the `x, y, z, w` (or `w, x, y, z`) notations. The equivalence is
376 /// as follows: `x -> i`, `y -> j`, `z -> k`, `w -> r`.
377 /// The memory layout of this type corresponds to the `x, y, z, w` notation
378 -#[derive(EuclidMatrix)]
379 #[repr(C)]
380 pub struct TypedRotation3D<T, Src, Dst> {
381 /// Component multiplied by the imaginary number `i`.
382 @@ -340,6 +394,67 @@ pub struct TypedRotation3D<T, Src, Dst> {
383 /// The default 3d rotation type with no units.
384 pub type Rotation3D<T> = TypedRotation3D<T, UnknownUnit, UnknownUnit>;
385
386 +impl<T: Copy, Src, Dst> Copy for TypedRotation3D<T, Src, Dst> {}
387 +
388 +impl<T: Clone, Src, Dst> Clone for TypedRotation3D<T, Src, Dst> {
389 + fn clone(&self) -> Self {
390 + TypedRotation3D {
391 + i: self.i.clone(),
392 + j: self.j.clone(),
393 + k: self.k.clone(),
394 + r: self.r.clone(),
395 + _unit: PhantomData,
396 + }
397 + }
398 +}
399 +
400 +#[cfg(feature = "serde")]
401 +impl<'de, T, Src, Dst> serde::Deserialize<'de> for TypedRotation3D<T, Src, Dst>
402 + where T: serde::Deserialize<'de>
403 +{
404 + fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
405 + where D: serde::Deserializer<'de>
406 + {
407 + let (i, j, k, r) = try!(serde::Deserialize::deserialize(deserializer));
408 + Ok(TypedRotation3D { i, j, k, r, _unit: PhantomData })
409 + }
410 +}
411 +
412 +#[cfg(feature = "serde")]
413 +impl<T, Src, Dst> serde::Serialize for TypedRotation3D<T, Src, Dst>
414 + where T: serde::Serialize
415 +{
416 + fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
417 + where S: serde::Serializer
418 + {
419 + (&self.i, &self.j, &self.k, &self.r).serialize(serializer)
420 + }
421 +}
422 +
423 +impl<T, Src, Dst> Eq for TypedRotation3D<T, Src, Dst> where T: Eq {}
424 +
425 +impl<T, Src, Dst> PartialEq for TypedRotation3D<T, Src, Dst>
426 + where T: PartialEq
427 +{
428 + fn eq(&self, other: &Self) -> bool {
429 + self.i == other.i &&
430 + self.j == other.j &&
431 + self.k == other.k &&
432 + self.r == other.r
433 + }
434 +}
435 +
436 +impl<T, Src, Dst> Hash for TypedRotation3D<T, Src, Dst>
437 + where T: Hash
438 +{
439 + fn hash<H: ::core::hash::Hasher>(&self, h: &mut H) {
440 + self.i.hash(h);
441 + self.j.hash(h);
442 + self.k.hash(h);
443 + self.r.hash(h);
444 + }
445 +}
446 +
447 impl<T, Src, Dst> TypedRotation3D<T, Src, Dst> {
448 /// Creates a rotation around from a quaternion representation.
449 ///
450 diff --git a/src/side_offsets.rs b/src/side_offsets.rs
451 index fb3d76c..aa2f3a7 100644
452 --- a/src/side_offsets.rs
453 +++ b/src/side_offsets.rs
454 @@ -16,10 +16,13 @@ use num::Zero;
455 use core::fmt;
456 use core::ops::Add;
457 use core::marker::PhantomData;
458 +use core::cmp::{Eq, PartialEq};
459 +use core::hash::{Hash};
460 +#[cfg(feature = "serde")]
461 +use serde;
462
463 /// A group of 2D side offsets, which correspond to top/left/bottom/right for borders, padding,
464 /// and margins in CSS, optionally tagged with a unit.
465 -#[derive(EuclidMatrix)]
466 #[repr(C)]
467 pub struct TypedSideOffsets2D<T, U> {
468 pub top: T,
469 @@ -30,6 +33,67 @@ pub struct TypedSideOffsets2D<T, U> {
470 pub _unit: PhantomData<U>,
471 }
472
473 +impl<T: Copy, U> Copy for TypedSideOffsets2D<T, U> {}
474 +
475 +impl<T: Clone, U> Clone for TypedSideOffsets2D<T, U> {
476 + fn clone(&self) -> Self {
477 + TypedSideOffsets2D {
478 + top: self.top.clone(),
479 + right: self.right.clone(),
480 + bottom: self.bottom.clone(),
481 + left: self.left.clone(),
482 + _unit: PhantomData,
483 + }
484 + }
485 +}
486 +
487 +#[cfg(feature = "serde")]
488 +impl<'de, T, U> serde::Deserialize<'de> for TypedSideOffsets2D<T, U>
489 + where T: serde::Deserialize<'de>
490 +{
491 + fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
492 + where D: serde::Deserializer<'de>
493 + {
494 + let (top, right, bottom, left) = try!(serde::Deserialize::deserialize(deserializer));
495 + Ok(TypedSideOffsets2D { top, right, bottom, left, _unit: PhantomData })
496 + }
497 +}
498 +
499 +#[cfg(feature = "serde")]
500 +impl<T, U> serde::Serialize for TypedSideOffsets2D<T, U>
501 + where T: serde::Serialize
502 +{
503 + fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
504 + where S: serde::Serializer
505 + {
506 + (&self.top, &self.right, &self.bottom, &self.left).serialize(serializer)
507 + }
508 +}
509 +
510 +impl<T, U> Eq for TypedSideOffsets2D<T, U> where T: Eq {}
511 +
512 +impl<T, U> PartialEq for TypedSideOffsets2D<T, U>
513 + where T: PartialEq
514 +{
515 + fn eq(&self, other: &Self) -> bool {
516 + self.top == other.top &&
517 + self.right == other.right &&
518 + self.bottom == other.bottom &&
519 + self.left == other.left
520 + }
521 +}
522 +
523 +impl<T, U> Hash for TypedSideOffsets2D<T, U>
524 + where T: Hash
525 +{
526 + fn hash<H: ::core::hash::Hasher>(&self, h: &mut H) {
527 + self.top.hash(h);
528 + self.right.hash(h);
529 + self.bottom.hash(h);
530 + self.left.hash(h);
531 + }
532 +}
533 +
534 impl<T: fmt::Debug, U> fmt::Debug for TypedSideOffsets2D<T, U> {
535 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
536 write!(
537 diff --git a/src/size.rs b/src/size.rs
538 index 9aae8f7..0101cc9 100644
539 --- a/src/size.rs
540 +++ b/src/size.rs
541 @@ -20,9 +20,12 @@ use num_traits::{Float, NumCast, Signed};
542 use core::fmt;
543 use core::ops::{Add, Div, Mul, Sub};
544 use core::marker::PhantomData;
545 +use core::cmp::{Eq, PartialEq};
546 +use core::hash::{Hash};
547 +#[cfg(feature = "serde")]
548 +use serde;
549
550 /// A 2d size tagged with a unit.
551 -#[derive(EuclidMatrix)]
552 #[repr(C)]
553 pub struct TypedSize2D<T, U> {
554 pub width: T,
555 @@ -31,6 +34,60 @@ pub struct TypedSize2D<T, U> {
556 pub _unit: PhantomData<U>,
557 }
558
559 +impl<T: Copy, U> Copy for TypedSize2D<T, U> {}
560 +
561 +impl<T: Clone, U> Clone for TypedSize2D<T, U> {
562 + fn clone(&self) -> Self {
563 + TypedSize2D {
564 + width: self.width.clone(),
565 + height: self.height.clone(),
566 + _unit: PhantomData,
567 + }
568 + }
569 +}
570 +
571 +#[cfg(feature = "serde")]
572 +impl<'de, T, U> serde::Deserialize<'de> for TypedSize2D<T, U>
573 + where T: serde::Deserialize<'de>
574 +{
575 + fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
576 + where D: serde::Deserializer<'de>
577 + {
578 + let (width, height) = try!(serde::Deserialize::deserialize(deserializer));
579 + Ok(TypedSize2D { width, height, _unit: PhantomData })
580 + }
581 +}
582 +
583 +#[cfg(feature = "serde")]
584 +impl<T, U> serde::Serialize for TypedSize2D<T, U>
585 + where T: serde::Serialize
586 +{
587 + fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
588 + where S: serde::Serializer
589 + {
590 + (&self.width, &self.height).serialize(serializer)
591 + }
592 +}
593 +
594 +impl<T, U> Eq for TypedSize2D<T, U> where T: Eq {}
595 +
596 +impl<T, U> PartialEq for TypedSize2D<T, U>
597 + where T: PartialEq
598 +{
599 + fn eq(&self, other: &Self) -> bool {
600 + self.width == other.width && self.height == other.height
601 + }
602 +}
603 +
604 +impl<T, U> Hash for TypedSize2D<T, U>
605 + where T: Hash
606 +{
607 + fn hash<H: ::core::hash::Hasher>(&self, h: &mut H) {
608 + self.width.hash(h);
609 + self.height.hash(h);
610 + }
611 +}
612 +
613 /// Default 2d size type with no unit.
614 ///
615 /// `Size2D` provides the same methods as `TypedSize2D`.
616 @@ -478,7 +535,6 @@ mod size2d {
617 }
618
619 /// A 3d size tagged with a unit.
620 -#[derive(EuclidMatrix)]
621 #[repr(C)]
622 pub struct TypedSize3D<T, U> {
623 pub width: T,
624 @@ -488,6 +544,62 @@ pub struct TypedSize3D<T, U> {
625 pub _unit: PhantomData<U>,
626 }
627
628 +impl<T: Copy, U> Copy for TypedSize3D<T, U> {}
629 +
630 +impl<T: Clone, U> Clone for TypedSize3D<T, U> {
631 + fn clone(&self) -> Self {
632 + TypedSize3D {
633 + width: self.width.clone(),
634 + height: self.height.clone(),
635 + depth: self.depth.clone(),
636 + _unit: PhantomData,
637 + }
638 + }
639 +}
640 +
641 +#[cfg(feature = "serde")]
642 +impl<'de, T, U> serde::Deserialize<'de> for TypedSize3D<T, U>
643 + where T: serde::Deserialize<'de>
644 +{
645 + fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
646 + where D: serde::Deserializer<'de>
647 + {
648 + let (width, height, depth) = try!(serde::Deserialize::deserialize(deserializer));
649 + Ok(TypedSize3D { width, height, depth, _unit: PhantomData })
650 + }
651 +}
652 +
653 +#[cfg(feature = "serde")]
654 +impl<T, U> serde::Serialize for TypedSize3D<T, U>
655 + where T: serde::Serialize
656 +{
657 + fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
658 + where S: serde::Serializer
659 + {
660 + (&self.width, &self.height, &self.depth).serialize(serializer)
661 + }
662 +}
663 +
664 +impl<T, U> Eq for TypedSize3D<T, U> where T: Eq {}
665 +
666 +impl<T, U> PartialEq for TypedSize3D<T, U>
667 + where T: PartialEq
668 +{
669 + fn eq(&self, other: &Self) -> bool {
670 + self.width == other.width && self.height == other.height && self.depth == other.depth
671 + }
672 +}
673 +
674 +impl<T, U> Hash for TypedSize3D<T, U>
675 + where T: Hash
676 +{
677 + fn hash<H: ::core::hash::Hasher>(&self, h: &mut H) {
678 + self.width.hash(h);
679 + self.height.hash(h);
680 + self.depth.hash(h);
681 + }
682 +}
683 +
684 /// Default 3d size type with no unit.
685 ///
686 /// `Size3D` provides the same methods as `TypedSize3D`.
687 diff --git a/src/transform2d.rs b/src/transform2d.rs
688 index 5e6af3d..14a52e9 100644
689 --- a/src/transform2d.rs
690 +++ b/src/transform2d.rs
691 @@ -19,10 +19,14 @@ use rect::TypedRect;
692 use transform3d::TypedTransform3D;
693 use core::ops::{Add, Mul, Div, Sub, Neg};
694 use core::marker::PhantomData;
695 +use core::cmp::{Eq, PartialEq};
696 +use core::hash::{Hash};
697 use approxeq::ApproxEq;
698 use trig::Trig;
699 use core::fmt;
700 use num_traits::NumCast;
701 +#[cfg(feature = "serde")]
702 +use serde;
703
704 /// A 2d transform stored as a 3 by 2 matrix in row-major order in memory.
705 ///
706 @@ -40,7 +44,6 @@ use num_traits::NumCast;
707 /// a vector is `v * T`. If your library is using column vectors, use `row_major` functions when you
708 /// are asked for `column_major` representations and vice versa.
709 #[repr(C)]
710 -#[derive(EuclidMatrix)]
711 pub struct TypedTransform2D<T, Src, Dst> {
712 pub m11: T, pub m12: T,
713 pub m21: T, pub m22: T,
714 @@ -52,6 +55,86 @@ pub struct TypedTransform2D<T, Src, Dst> {
715 /// The default 2d transform type with no units.
716 pub type Transform2D<T> = TypedTransform2D<T, UnknownUnit, UnknownUnit>;
717
718 +impl<T: Copy, Src, Dst> Copy for TypedTransform2D<T, Src, Dst> {}
719 +
720 +impl<T: Clone, Src, Dst> Clone for TypedTransform2D<T, Src, Dst> {
721 + fn clone(&self) -> Self {
722 + TypedTransform2D {
723 + m11: self.m11.clone(),
724 + m12: self.m12.clone(),
725 + m21: self.m21.clone(),
726 + m22: self.m22.clone(),
727 + m31: self.m31.clone(),
728 + m32: self.m32.clone(),
729 + _unit: PhantomData,
730 + }
731 + }
732 +}
733 +
734 +#[cfg(feature = "serde")]
735 +impl<'de, T, Src, Dst> serde::Deserialize<'de> for TypedTransform2D<T, Src, Dst>
736 + where T: serde::Deserialize<'de>
737 +{
738 + fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
739 + where D: serde::Deserializer<'de>
740 + {
741 + let (
742 + m11, m12,
743 + m21, m22,
744 + m31, m32,
745 + ) = try!(serde::Deserialize::deserialize(deserializer));
746 + Ok(TypedTransform2D {
747 + m11, m12,
748 + m21, m22,
749 + m31, m32,
750 + _unit: PhantomData
751 + })
752 + }
753 +}
754 +
755 +#[cfg(feature = "serde")]
756 +impl<T, Src, Dst> serde::Serialize for TypedTransform2D<T, Src, Dst>
757 + where T: serde::Serialize
758 +{
759 + fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
760 + where S: serde::Serializer
761 + {
762 + (
763 + &self.m11, &self.m12,
764 + &self.m21, &self.m22,
765 + &self.m31, &self.m32,
766 + ).serialize(serializer)
767 + }
768 +}
769 +
770 +impl<T, Src, Dst> Eq for TypedTransform2D<T, Src, Dst> where T: Eq {}
771 +
772 +impl<T, Src, Dst> PartialEq for TypedTransform2D<T, Src, Dst>
773 + where T: PartialEq
774 +{
775 + fn eq(&self, other: &Self) -> bool {
776 + self.m11 == other.m11 &&
777 + self.m12 == other.m12 &&
778 + self.m21 == other.m21 &&
779 + self.m22 == other.m22 &&
780 + self.m31 == other.m31 &&
781 + self.m32 == other.m32
782 + }
783 +}
784 +
785 +impl<T, Src, Dst> Hash for TypedTransform2D<T, Src, Dst>
786 + where T: Hash
787 +{
788 + fn hash<H: ::core::hash::Hasher>(&self, h: &mut H) {
789 + self.m11.hash(h);
790 + self.m12.hash(h);
791 + self.m21.hash(h);
792 + self.m22.hash(h);
793 + self.m31.hash(h);
794 + self.m32.hash(h);
795 + }
796 +}
797 +
798 impl<T: Copy, Src, Dst> TypedTransform2D<T, Src, Dst> {
799 /// Create a transform specifying its matrix elements in row-major order.
800 ///
801 diff --git a/src/transform3d.rs b/src/transform3d.rs
802 index 13c6f71..d71a9fa 100644
803 --- a/src/transform3d.rs
804 +++ b/src/transform3d.rs
805 @@ -24,7 +24,11 @@ use num::{One, Zero};
806 use core::ops::{Add, Mul, Sub, Div, Neg};
807 use core::marker::PhantomData;
808 use core::fmt;
809 +use core::cmp::{Eq, PartialEq};
810 +use core::hash::{Hash};
811 use num_traits::NumCast;
812 +#[cfg(feature = "serde")]
813 +use serde;
814
815 /// A 3d transform stored as a 4 by 4 matrix in row-major order in memory.
816 ///
817 @@ -41,7 +45,6 @@ use num_traits::NumCast;
818 /// These transforms are for working with _row vectors_, so the matrix math for transforming
819 /// a vector is `v * T`. If your library is using column vectors, use `row_major` functions when you
820 /// are asked for `column_major` representations and vice versa.
821 -#[derive(EuclidMatrix)]
822 #[repr(C)]
823 pub struct TypedTransform3D<T, Src, Dst> {
824 pub m11: T, pub m12: T, pub m13: T, pub m14: T,
825 @@ -55,6 +58,119 @@ pub struct TypedTransform3D<T, Src, Dst> {
826 /// The default 3d transform type with no units.
827 pub type Transform3D<T> = TypedTransform3D<T, UnknownUnit, UnknownUnit>;
828
829 +impl<T: Copy, Src, Dst> Copy for TypedTransform3D<T, Src, Dst> {}
830 +
831 +impl<T: Clone, Src, Dst> Clone for TypedTransform3D<T, Src, Dst> {
832 + fn clone(&self) -> Self {
833 + TypedTransform3D {
834 + m11: self.m11.clone(),
835 + m12: self.m12.clone(),
836 + m13: self.m13.clone(),
837 + m14: self.m14.clone(),
838 + m21: self.m21.clone(),
839 + m22: self.m22.clone(),
840 + m23: self.m23.clone(),
841 + m24: self.m24.clone(),
842 + m31: self.m31.clone(),
843 + m32: self.m32.clone(),
844 + m33: self.m33.clone(),
845 + m34: self.m34.clone(),
846 + m41: self.m41.clone(),
847 + m42: self.m42.clone(),
848 + m43: self.m43.clone(),
849 + m44: self.m44.clone(),
850 + _unit: PhantomData,
851 + }
852 + }
853 +}
854 +
855 +#[cfg(feature = "serde")]
856 +impl<'de, T, Src, Dst> serde::Deserialize<'de> for TypedTransform3D<T, Src, Dst>
857 + where T: serde::Deserialize<'de>
858 +{
859 + fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
860 + where D: serde::Deserializer<'de>
861 + {
862 + let (
863 + m11, m12, m13, m14,
864 + m21, m22, m23, m24,
865 + m31, m32, m33, m34,
866 + m41, m42, m43, m44,
867 + ) = try!(serde::Deserialize::deserialize(deserializer));
868 + Ok(TypedTransform3D {
869 + m11, m12, m13, m14,
870 + m21, m22, m23, m24,
871 + m31, m32, m33, m34,
872 + m41, m42, m43, m44,
873 + _unit: PhantomData
874 + })
875 + }
876 +}
877 +
878 +#[cfg(feature = "serde")]
879 +impl<T, Src, Dst> serde::Serialize for TypedTransform3D<T, Src, Dst>
880 + where T: serde::Serialize
881 +{
882 + fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
883 + where S: serde::Serializer
884 + {
885 + (
886 + &self.m11, &self.m12, &self.m13, &self.m14,
887 + &self.m21, &self.m22, &self.m23, &self.m24,
888 + &self.m31, &self.m32, &self.m33, &self.m34,
889 + &self.m41, &self.m42, &self.m43, &self.m44,
890 + ).serialize(serializer)
891 + }
892 +}
893 +
894 +impl<T, Src, Dst> Eq for TypedTransform3D<T, Src, Dst> where T: Eq {}
895 +
896 +impl<T, Src, Dst> PartialEq for TypedTransform3D<T, Src, Dst>
897 + where T: PartialEq
898 +{
899 + fn eq(&self, other: &Self) -> bool {
900 + self.m11 == other.m11 &&
901 + self.m12 == other.m12 &&
902 + self.m13 == other.m13 &&
903 + self.m14 == other.m14 &&
904 + self.m21 == other.m21 &&
905 + self.m22 == other.m22 &&
906 + self.m23 == other.m23 &&
907 + self.m24 == other.m24 &&
908 + self.m31 == other.m31 &&
909 + self.m32 == other.m32 &&
910 + self.m33 == other.m33 &&
911 + self.m34 == other.m34 &&
912 + self.m41 == other.m41 &&
913 + self.m42 == other.m42 &&
914 + self.m43 == other.m43 &&
915 + self.m44 == other.m44
916 + }
917 +}
918 +
919 +impl<T, Src, Dst> Hash for TypedTransform3D<T, Src, Dst>
920 + where T: Hash
921 +{
922 + fn hash<H: ::core::hash::Hasher>(&self, h: &mut H) {
923 + self.m11.hash(h);
924 + self.m12.hash(h);
925 + self.m13.hash(h);
926 + self.m14.hash(h);
927 + self.m21.hash(h);
928 + self.m22.hash(h);
929 + self.m23.hash(h);
930 + self.m24.hash(h);
931 + self.m31.hash(h);
932 + self.m32.hash(h);
933 + self.m33.hash(h);
934 + self.m34.hash(h);
935 + self.m41.hash(h);
936 + self.m42.hash(h);
937 + self.m43.hash(h);
938 + self.m44.hash(h);
939 + }
940 +}
941 +
942 impl<T, Src, Dst> TypedTransform3D<T, Src, Dst> {
943 /// Create a transform specifying its components in row-major order.
944 ///
945 diff --git a/src/translation.rs b/src/translation.rs
946 index 9f3ca04..ed85c32 100644
947 --- a/src/translation.rs
948 +++ b/src/translation.rs
949 @@ -14,6 +14,10 @@ use trig::Trig;
950 use core::ops::{Add, Sub, Neg, Mul, Div};
951 use core::marker::PhantomData;
952 use core::fmt;
953 +use core::cmp::{Eq, PartialEq};
954 +use core::hash::{Hash};
955 +#[cfg(feature = "serde")]
956 +use serde;
957
958 /// A 2d transformation from a space to another that can only express translations.
959 ///
960 @@ -35,7 +39,6 @@ use core::fmt;
961 /// let p2: ChildPoint = scrolling.transform_point(&p1);
962 /// ```
963 ///
964 -#[derive(EuclidMatrix)]
965 #[repr(C)]
966 pub struct TypedTranslation2D<T, Src, Dst> {
967 pub x: T,
968 @@ -44,6 +47,60 @@ pub struct TypedTranslation2D<T, Src, Dst> {
969 pub _unit: PhantomData<(Src, Dst)>,
970 }
971
972 +impl<T: Copy, Src, Dst> Copy for TypedTranslation2D<T, Src, Dst> {}
973 +
974 +impl<T: Clone, Src, Dst> Clone for TypedTranslation2D<T, Src, Dst> {
975 + fn clone(&self) -> Self {
976 + TypedTranslation2D {
977 + x: self.x.clone(),
978 + y: self.y.clone(),
979 + _unit: PhantomData,
980 + }
981 + }
982 +}
983 +
984 +#[cfg(feature = "serde")]
985 +impl<'de, T, Src, Dst> serde::Deserialize<'de> for TypedTranslation2D<T, Src, Dst>
986 + where T: serde::Deserialize<'de>
987 +{
988 + fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
989 + where D: serde::Deserializer<'de>
990 + {
991 + let (x, y) = try!(serde::Deserialize::deserialize(deserializer));
992 + Ok(TypedTranslation2D { x, y, _unit: PhantomData })
993 + }
994 +}
995 +
996 +#[cfg(feature = "serde")]
997 +impl<T, Src, Dst> serde::Serialize for TypedTranslation2D<T, Src, Dst>
998 + where T: serde::Serialize
999 +{
1000 + fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1001 + where S: serde::Serializer
1002 + {
1003 + (&self.x, &self.y).serialize(serializer)
1004 + }
1005 +}
1006 +
1007 +impl<T, Src, Dst> Eq for TypedTranslation2D<T, Src, Dst> where T: Eq {}
1008 +
1009 +impl<T, Src, Dst> PartialEq for TypedTranslation2D<T, Src, Dst>
1010 + where T: PartialEq
1011 +{
1012 + fn eq(&self, other: &Self) -> bool {
1013 + self.x == other.x && self.y == other.y
1014 + }
1015 +}
1016 +
1017 +impl<T, Src, Dst> Hash for TypedTranslation2D<T, Src, Dst>
1018 + where T: Hash
1019 +{
1020 + fn hash<H: ::core::hash::Hasher>(&self, h: &mut H) {
1021 + self.x.hash(h);
1022 + self.y.hash(h);
1023 + }
1024 +}
1025 +
1026 impl<T, Src, Dst> TypedTranslation2D<T, Src, Dst> {
1027 #[inline]
1028 pub fn new(x: T, y: T) -> Self {
1029 @@ -239,7 +296,6 @@ where T: Copy + fmt::Debug {
1030 ///
1031 /// The main benefit of this type over a TypedVector3D is the ability to cast
1032 /// between a source and a destination spaces.
1033 -#[derive(EuclidMatrix)]
1034 #[repr(C)]
1035 pub struct TypedTranslation3D<T, Src, Dst> {
1036 pub x: T,
1037 @@ -249,6 +305,62 @@ pub struct TypedTranslation3D<T, Src, Dst> {
1038 pub _unit: PhantomData<(Src, Dst)>,
1039 }
1040
1041 +impl<T: Copy, Src, Dst> Copy for TypedTranslation3D<T, Src, Dst> {}
1042 +
1043 +impl<T: Clone, Src, Dst> Clone for TypedTranslation3D<T, Src, Dst> {
1044 + fn clone(&self) -> Self {
1045 + TypedTranslation3D {
1046 + x: self.x.clone(),
1047 + y: self.y.clone(),
1048 + z: self.z.clone(),
1049 + _unit: PhantomData,
1050 + }
1051 + }
1052 +}
1053 +
1054 +#[cfg(feature = "serde")]
1055 +impl<'de, T, Src, Dst> serde::Deserialize<'de> for TypedTranslation3D<T, Src, Dst>
1056 + where T: serde::Deserialize<'de>
1057 +{
1058 + fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1059 + where D: serde::Deserializer<'de>
1060 + {
1061 + let (x, y, z) = try!(serde::Deserialize::deserialize(deserializer));
1062 + Ok(TypedTranslation3D { x, y, z, _unit: PhantomData })
1063 + }
1064 +}
1065 +
1066 +#[cfg(feature = "serde")]
1067 +impl<T, Src, Dst> serde::Serialize for TypedTranslation3D<T, Src, Dst>
1068 + where T: serde::Serialize
1069 +{
1070 + fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1071 + where S: serde::Serializer
1072 + {
1073 + (&self.x, &self.y, &self.z).serialize(serializer)
1074 + }
1075 +}
1076 +
1077 +impl<T, Src, Dst> Eq for TypedTranslation3D<T, Src, Dst> where T: Eq {}
1078 +
1079 +impl<T, Src, Dst> PartialEq for TypedTranslation3D<T, Src, Dst>
1080 + where T: PartialEq
1081 +{
1082 + fn eq(&self, other: &Self) -> bool {
1083 + self.x == other.x && self.y == other.y && self.z == other.z
1084 + }
1085 +}
1086 +
1087 +impl<T, Src, Dst> Hash for TypedTranslation3D<T, Src, Dst>
1088 + where T: Hash
1089 +{
1090 + fn hash<H: ::core::hash::Hasher>(&self, h: &mut H) {
1091 + self.x.hash(h);
1092 + self.y.hash(h);
1093 + self.z.hash(h);
1094 + }
1095 +}
1096 +
1097 impl<T, Src, Dst> TypedTranslation3D<T, Src, Dst> {
1098 #[inline]
1099 pub fn new(x: T, y: T, z: T) -> Self {
1100 diff --git a/src/vector.rs b/src/vector.rs
1101 index ec87657..ec6eac0 100644
1102 --- a/src/vector.rs
1103 +++ b/src/vector.rs
1104 @@ -24,9 +24,12 @@ use num_traits::{Float, NumCast, Signed};
1105 use core::fmt;
1106 use core::ops::{Add, AddAssign, Div, DivAssign, Mul, MulAssign, Neg, Sub, SubAssign};
1107 use core::marker::PhantomData;
1108 +use core::cmp::{Eq, PartialEq};
1109 +use core::hash::{Hash};
1110 +#[cfg(feature = "serde")]
1111 +use serde;
1112
1113 /// A 2d Vector tagged with a unit.
1114 -#[derive(EuclidMatrix)]
1115 #[repr(C)]
1116 pub struct TypedVector2D<T, U> {
1117 pub x: T,
1118 @@ -37,6 +40,60 @@ pub struct TypedVector2D<T, U> {
1119
1120 mint_vec!(TypedVector2D[x, y] = Vector2);
1121
1122 +impl<T: Copy, U> Copy for TypedVector2D<T, U> {}
1123 +
1124 +impl<T: Clone, U> Clone for TypedVector2D<T, U> {
1125 + fn clone(&self) -> Self {
1126 + TypedVector2D {
1127 + x: self.x.clone(),
1128 + y: self.y.clone(),
1129 + _unit: PhantomData,
1130 + }
1131 + }
1132 +}
1133 +
1134 +#[cfg(feature = "serde")]
1135 +impl<'de, T, U> serde::Deserialize<'de> for TypedVector2D<T, U>
1136 + where T: serde::Deserialize<'de>
1137 +{
1138 + fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1139 + where D: serde::Deserializer<'de>
1140 + {
1141 + let (x, y) = try!(serde::Deserialize::deserialize(deserializer));
1142 + Ok(TypedVector2D { x, y, _unit: PhantomData })
1143 + }
1144 +}
1145 +
1146 +#[cfg(feature = "serde")]
1147 +impl<T, U> serde::Serialize for TypedVector2D<T, U>
1148 + where T: serde::Serialize
1149 +{
1150 + fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1151 + where S: serde::Serializer
1152 + {
1153 + (&self.x, &self.y).serialize(serializer)
1154 + }
1155 +}
1156 +
1157 +impl<T, U> Eq for TypedVector2D<T, U> where T: Eq {}
1158 +
1159 +impl<T, U> PartialEq for TypedVector2D<T, U>
1160 + where T: PartialEq
1161 +{
1162 + fn eq(&self, other: &Self) -> bool {
1163 + self.x == other.x && self.y == other.y
1164 + }
1165 +}
1166 +
1167 +impl<T, U> Hash for TypedVector2D<T, U>
1168 + where T: Hash
1169 +{
1170 + fn hash<H: ::core::hash::Hasher>(&self, h: &mut H) {
1171 + self.x.hash(h);
1172 + self.y.hash(h);
1173 + }
1174 +}
1175 +
1176 /// Default 2d vector type with no unit.
1177 ///
1178 /// `Vector2D` provides the same methods as `TypedVector2D`.
1179 @@ -521,7 +578,6 @@ where
1180 }
1181
1182 /// A 3d Vector tagged with a unit.
1183 -#[derive(EuclidMatrix)]
1184 #[repr(C)]
1185 pub struct TypedVector3D<T, U> {
1186 pub x: T,
1187 @@ -533,6 +589,62 @@ pub struct TypedVector3D<T, U> {
1188
1189 mint_vec!(TypedVector3D[x, y, z] = Vector3);
1190
1191 +impl<T: Copy, U> Copy for TypedVector3D<T, U> {}
1192 +
1193 +impl<T: Clone, U> Clone for TypedVector3D<T, U> {
1194 + fn clone(&self) -> Self {
1195 + TypedVector3D {
1196 + x: self.x.clone(),
1197 + y: self.y.clone(),
1198 + z: self.z.clone(),
1199 + _unit: PhantomData,
1200 + }
1201 + }
1202 +}
1203 +
1204 +#[cfg(feature = "serde")]
1205 +impl<'de, T, U> serde::Deserialize<'de> for TypedVector3D<T, U>
1206 + where T: serde::Deserialize<'de>
1207 +{
1208 + fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
1209 + where D: serde::Deserializer<'de>
1210 + {
1211 + let (x, y, z) = try!(serde::Deserialize::deserialize(deserializer));
1212 + Ok(TypedVector3D { x, y, z, _unit: PhantomData })
1213 + }
1214 +}
1215 +
1216 +#[cfg(feature = "serde")]
1217 +impl<T, U> serde::Serialize for TypedVector3D<T, U>
1218 + where T: serde::Serialize
1219 +{
1220 + fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
1221 + where S: serde::Serializer
1222 + {
1223 + (&self.x, &self.y, &self.z).serialize(serializer)
1224 + }
1225 +}
1226 +
1227 +impl<T, U> Eq for TypedVector3D<T, U> where T: Eq {}
1228 +
1229 +impl<T, U> PartialEq for TypedVector3D<T, U>
1230 + where T: PartialEq
1231 +{
1232 + fn eq(&self, other: &Self) -> bool {
1233 + self.x == other.x && self.y == other.y && self.z == other.z
1234 + }
1235 +}
1236 +
1237 +impl<T, U> Hash for TypedVector3D<T, U>
1238 + where T: Hash
1239 +{
1240 + fn hash<H: ::core::hash::Hasher>(&self, h: &mut H) {
1241 + self.x.hash(h);
1242 + self.y.hash(h);
1243 + self.z.hash(h);
1244 + }
1245 +}
1246 +
1247 /// Default 3d vector type with no unit.
1248 ///
1249 /// `Vector3D` provides the same methods as `TypedVector3D`.
1250 --
1251 2.20.1
1252
0 0001-Remove-euclid_macros.patch
+0
-6
src/euclid-macros/debian/changelog less more
0 rust-euclid-macros (0.1.0-1) unstable; urgency=medium
1
2 * Team upload.
3 * Package euclid_macros 0.1.0 from crates.io using debcargo 2.2.9
4
5 -- Andrej Shadura <andrewsh@debian.org> Sun, 20 Jan 2019 21:25:34 +0100
+0
-46
src/euclid-macros/debian/copyright less more
0 Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
1 Upstream-Name: euclid
2 Upstream-Contact: The Servo Project Developers
3 Source: https://github.com/servo/euclid
4
5 Files: *
6 Copyright:
7 2012—2013 Mozilla Foundation
8 2013—2019 The Servo Project Developers
9 License: MIT or Apache-2.0
10 Comment:
11 Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
12 http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
13 <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
14 option. This file may not be copied, modified, or distributed
15 except according to those terms.
16
17
18 Files: debian/*
19 Copyright:
20 2019 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
21 2019 Andrej Shadura <andrewsh@debian.org>
22 License: MIT or Apache-2.0
23
24 License: Apache-2.0
25 Debian systems provide the Apache 2.0 license in
26 /usr/share/common-licenses/Apache-2.0
27
28 License: MIT
29 Permission is hereby granted, free of charge, to any person obtaining a copy
30 of this software and associated documentation files (the "Software"), to deal
31 in the Software without restriction, including without limitation the rights
32 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
33 copies of the Software, and to permit persons to whom the Software is
34 furnished to do so, subject to the following conditions:
35 .
36 The above copyright notice and this permission notice shall be included in all
37 copies or substantial portions of the Software.
38 .
39 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
40 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
41 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
42 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
43 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
44 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
45 SOFTWARE.
+0
-52
src/euclid-macros/debian/copyright.debcargo.hint less more
0 Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/
1 Upstream-Name: euclid_macros
2 Upstream-Contact:
3 Emilio Cobos Álvarez <emilio@crisal.io>
4 The Servo project developers
5
6 Files: *
7 Copyright:
8 FIXME (overlay) UNKNOWN-YEARS Emilio Cobos Álvarez <emilio@crisal.io>
9 FIXME (overlay) UNKNOWN-YEARS The Servo project developers
10 License: MIT or Apache-2.0
11 Comment:
12 FIXME (overlay): Since upstream copyright years are not available in
13 Cargo.toml, they were extracted from the upstream Git repository. This may not
14 be correct information so you should review and fix this before uploading to
15 the archive.
16
17 Files: ./LICENSE-MIT
18 Copyright: 2012-2013 Mozilla Foundation
19 License: UNKNOWN-LICENSE; FIXME (overlay)
20 Comment:
21 FIXME (overlay): These notices are extracted from files. Please review them
22 before uploading to the archive.
23
24 Files: debian/*
25 Copyright:
26 2019 Debian Rust Maintainers <pkg-rust-maintainers@alioth-lists.debian.net>
27 2019 <andrewsh@debian.org>
28 License: MIT or Apache-2.0
29
30 License: Apache-2.0
31 Debian systems provide the Apache 2.0 license in
32 /usr/share/common-licenses/Apache-2.0
33
34 License: MIT
35 Permission is hereby granted, free of charge, to any person obtaining a copy
36 of this software and associated documentation files (the "Software"), to deal
37 in the Software without restriction, including without limitation the rights
38 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
39 copies of the Software, and to permit persons to whom the Software is
40 furnished to do so, subject to the following conditions:
41 .
42 The above copyright notice and this permission notice shall be included in all
43 copies or substantial portions of the Software.
44 .
45 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
46 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
47 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
48 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
49 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
50 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
51 SOFTWARE.
+0
-2
src/euclid-macros/debian/debcargo.toml less more
0 overlay = "."
1 uploaders = ["Andrej Shadura <andrewsh@debian.org>"]