diff options
Diffstat (limited to 'src/layout/boxed.rs')
| -rw-r--r-- | src/layout/boxed.rs | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/layout/boxed.rs b/src/layout/boxed.rs index afcd5278..5bd909d4 100644 --- a/src/layout/boxed.rs +++ b/src/layout/boxed.rs @@ -1,5 +1,6 @@ //! Block-style layouting of boxes. +use std::io::{self, Write}; use crate::doc::{Document, Page, LayoutAction}; use crate::size::{Size, Size2D}; use super::{ActionList, LayoutSpace, Alignment, LayoutResult, LayoutError}; @@ -25,6 +26,16 @@ impl BoxLayout { }], } } + + /// Serialize this layout into a string representation. + pub fn serialize<W: Write>(&self, f: &mut W) -> io::Result<()> { + writeln!(f, "{:.4} {:.4}", self.dimensions.x.to_pt(), self.dimensions.y.to_pt())?; + for action in &self.actions { + action.serialize(f)?; + writeln!(f)?; + } + Ok(()) + } } /// The context for layouting boxes. |
