diff options
| author | Laurenz <laurmaedje@gmail.com> | 2019-11-30 14:10:35 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2019-11-30 14:10:35 +0100 |
| commit | b13ed627fff73a599b34d760cd99aa2f08d58ea8 (patch) | |
| tree | f580390e1666af9f4f54c72c95ca438d4c999900 /src/layout/flex.rs | |
| parent | b4efae08834a3a950387f01aebaa9e832acd9423 (diff) | |
Better error reporting 🚨
Diffstat (limited to 'src/layout/flex.rs')
| -rw-r--r-- | src/layout/flex.rs | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/src/layout/flex.rs b/src/layout/flex.rs index 053954a4..53f6dfdf 100644 --- a/src/layout/flex.rs +++ b/src/layout/flex.rs @@ -126,20 +126,8 @@ impl FlexLayouter { } } - pub fn remaining(&self) -> LayoutResult<(LayoutSpaces, Option<LayoutSpaces>)> { - if self.run_is_empty() { - Ok((self.stack.remaining(), None)) - } else { - let mut future = self.clone(); - let remaining_run = future.finish_run()?; - - let stack_spaces = future.stack.remaining(); - let mut flex_spaces = stack_spaces.clone(); - flex_spaces[0].dimensions.x = remaining_run.x; - flex_spaces[0].dimensions.y += remaining_run.y; - - Ok((flex_spaces, Some(stack_spaces))) - } + pub fn remaining(&self) -> LayoutSpaces { + self.stack.remaining() } pub fn run_is_empty(&self) -> bool { @@ -242,7 +230,7 @@ impl FlexLayouter { while size.x > self.line.usable { if self.stack.space_is_last() { - Err(LayoutError::NotEnoughSpace("failed to add box to flex run"))?; + lerr!("box does not fit into line"); } self.stack.finish_space(true); |
