summaryrefslogtreecommitdiff
path: root/src/layout/mod.rs
diff options
context:
space:
mode:
authorLaurenz <laurmaedje@gmail.com>2020-08-02 16:56:14 +0200
committerLaurenz <laurmaedje@gmail.com>2020-08-02 16:56:14 +0200
commitd5ff97f42ed1e682a66ea8d51e5f9ed1be547b9c (patch)
tree2fdc3a368c4320051e3f62a460f3912fe5f44c7c /src/layout/mod.rs
parent533374db14087ac54fdc86afa5f009487ac1b850 (diff)
Move binary into separate crate and tidy dependencies 🎭
Diffstat (limited to 'src/layout/mod.rs')
-rw-r--r--src/layout/mod.rs12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs
index 510f504a..64a2825b 100644
--- a/src/layout/mod.rs
+++ b/src/layout/mod.rs
@@ -1,10 +1,11 @@
//! Layouting types and engines.
use std::fmt::{self, Display, Formatter};
-use smallvec::SmallVec;
+
+#[cfg(feature = "serialize")]
use serde::Serialize;
-use fontdock::FaceId;
+use fontdock::FaceId;
use crate::geom::{Size, Margins};
use self::prelude::*;
@@ -31,12 +32,13 @@ pub mod prelude {
pub type MultiLayout = Vec<Layout>;
/// A finished box with content at fixed positions.
-#[derive(Debug, Clone, PartialEq, Serialize)]
+#[derive(Debug, Clone, PartialEq)]
+#[cfg_attr(feature = "serialize", derive(Serialize))]
pub struct Layout {
/// The size of the box.
pub dimensions: Size,
/// How to align this layout in a parent container.
- #[serde(skip)]
+ #[cfg_attr(feature = "serialize", serde(skip))]
pub align: LayoutAlign,
/// The actions composing this layout.
pub actions: Vec<LayoutAction>,
@@ -59,7 +61,7 @@ impl Layout {
/// A vector of layout spaces, that is stack allocated as long as it only
/// contains at most 2 spaces.
-pub type LayoutSpaces = SmallVec<[LayoutSpace; 2]>;
+pub type LayoutSpaces = Vec<LayoutSpace>;
/// The space into which content is laid out.
#[derive(Debug, Copy, Clone, PartialEq)]