[librsvg: 2/5] aspect_ratio: Move impl Defualts under the struct declarations.
- From: Federico Mena Quintero <federico src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [librsvg: 2/5] aspect_ratio: Move impl Defualts under the struct declarations.
- Date: Fri, 16 Mar 2018 22:09:09 +0000 (UTC)
commit dd10d212c00ef2e205f4d7f4eb666a117d758232
Author: Jordan Petridis <jordanpetridis protonmail com>
Date: Fri Mar 16 01:59:56 2018 +0200
aspect_ratio: Move impl Defualts under the struct declarations.
rsvg_internals/src/aspect_ratio.rs | 50 +++++++++++++++++++-------------------
1 file changed, 25 insertions(+), 25 deletions(-)
---
diff --git a/rsvg_internals/src/aspect_ratio.rs b/rsvg_internals/src/aspect_ratio.rs
index 8d685de1..238bc0e0 100644
--- a/rsvg_internals/src/aspect_ratio.rs
+++ b/rsvg_internals/src/aspect_ratio.rs
@@ -31,12 +31,27 @@ pub struct AspectRatio {
align: Option<Align>,
}
+impl Default for AspectRatio {
+ fn default() -> AspectRatio {
+ AspectRatio {
+ defer: false,
+ align: Some(Align::default()),
+ }
+ }
+}
+
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
enum FitMode {
Meet,
Slice,
}
+impl Default for FitMode {
+ fn default() -> FitMode {
+ FitMode::Meet
+ }
+}
+
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
struct Align {
x: Align1D,
@@ -44,6 +59,16 @@ struct Align {
fit: FitMode,
}
+impl Default for Align {
+ fn default() -> Align {
+ Align {
+ x: Align1D::Mid,
+ y: Align1D::Mid,
+ fit: FitMode::default(),
+ }
+ }
+}
+
#[derive(Debug, Copy, Clone, PartialEq, Eq)]
enum Align1D {
Min,
@@ -127,31 +152,6 @@ impl AspectRatio {
}
}
-impl Default for AspectRatio {
- fn default() -> AspectRatio {
- AspectRatio {
- defer: false,
- align: Some(Align::default()),
- }
- }
-}
-
-impl Default for FitMode {
- fn default() -> FitMode {
- FitMode::Meet
- }
-}
-
-impl Default for Align {
- fn default() -> Align {
- Align {
- x: Align1D::Mid,
- y: Align1D::Mid,
- fit: FitMode::default(),
- }
- }
-}
-
impl Align {
fn parse_xy(s: &str) -> Result<Option<(Align1D, Align1D)>, ()> {
use self::Align1D::*;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]