diff options
| author | Laurenz <laurmaedje@gmail.com> | 2019-10-13 13:10:21 +0200 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2019-10-13 13:10:21 +0200 |
| commit | 7c0899b5373cdc4f1083a0a8515856207c431423 (patch) | |
| tree | ee1ecade4022f1fa3f666feb55097f7bdcae69ed /src/layout/actions.rs | |
| parent | 5c04185892947969005ffcf6412d7190dafb3a79 (diff) | |
Run rustfmt 🚿
Diffstat (limited to 'src/layout/actions.rs')
| -rw-r--r-- | src/layout/actions.rs | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/src/layout/actions.rs b/src/layout/actions.rs index 069c3f7c..3eb4fb7f 100644 --- a/src/layout/actions.rs +++ b/src/layout/actions.rs @@ -3,11 +3,10 @@ use std::fmt::{self, Display, Formatter}; use std::io::{self, Write}; -use crate::size::Size2D; use super::Layout; +use crate::size::Size2D; use LayoutAction::*; - /// A layouting action. #[derive(Clone)] pub enum LayoutAction { @@ -30,8 +29,14 @@ impl LayoutAction { MoveAbsolute(s) => write!(f, "m {:.4} {:.4}", s.x.to_pt(), s.y.to_pt()), SetFont(i, s) => write!(f, "f {} {}", i, s), WriteText(s) => write!(f, "w {}", s), - DebugBox(p, s) => write!(f, "b {} {} {} {}", - p.x.to_pt(), p.y.to_pt(), s.x.to_pt(), s.y.to_pt()) + DebugBox(p, s) => write!( + f, + "b {} {} {} {}", + p.x.to_pt(), + p.y.to_pt(), + s.x.to_pt(), + s.y.to_pt() + ), } } } @@ -81,7 +86,7 @@ impl LayoutActionList { SetFont(index, size) if (index, size) != self.active_font => { self.next_font = Some((index, size)); - }, + } _ => { if let Some(target) = self.next_pos.take() { @@ -92,19 +97,21 @@ impl LayoutActionList { } self.actions.push(action); - }, + } } } /// Add a series of actions. - pub fn extend<I>(&mut self, actions: I) where I: IntoIterator<Item=LayoutAction> { + pub fn extend<I>(&mut self, actions: I) + where I: IntoIterator<Item = LayoutAction> { for action in actions.into_iter() { self.add(action); } } /// Add all actions from a box layout at a position. A move to the position - /// is generated and all moves inside the box layout are translated as necessary. + /// is generated and all moves inside the box layout are translated as + /// necessary. pub fn add_box(&mut self, position: Size2D, layout: Layout) { if let Some(target) = self.next_pos.take() { self.actions.push(MoveAbsolute(target)); @@ -114,7 +121,8 @@ impl LayoutActionList { self.origin = position; if layout.debug_render { - self.actions.push(LayoutAction::DebugBox(position, layout.dimensions)); + self.actions + .push(LayoutAction::DebugBox(position, layout.dimensions)); } self.extend(layout.actions); |
