diff options
| author | Laurenz <laurmaedje@gmail.com> | 2019-12-04 20:20:02 +0100 |
|---|---|---|
| committer | Laurenz <laurmaedje@gmail.com> | 2019-12-04 20:20:02 +0100 |
| commit | f72b1505bebf8d2fe1a60d386a3a3c3b67d4f903 (patch) | |
| tree | 09fa7137a2bae5454e6f9cecc1936633c90965d4 /src/layout/mod.rs | |
| parent | 9fb31defd037a90bf8f9e38fa33acae23a70b269 (diff) | |
Unify error types ♾
Diffstat (limited to 'src/layout/mod.rs')
| -rw-r--r-- | src/layout/mod.rs | 21 |
1 files changed, 2 insertions, 19 deletions
diff --git a/src/layout/mod.rs b/src/layout/mod.rs index 4304e46e..690e91b7 100644 --- a/src/layout/mod.rs +++ b/src/layout/mod.rs @@ -5,8 +5,8 @@ use std::io::{self, Write}; use smallvec::SmallVec; use toddle::query::{FontClass, SharedFontLoader}; -use toddle::Error as FontError; +use crate::TypesetResult; use crate::func::Command; use crate::size::{Size, Size2D, SizeBox}; use crate::style::{LayoutStyle, TextStyle}; @@ -366,22 +366,5 @@ impl Serialize for MultiLayout { } } -/// The error type for layouting. -pub struct LayoutError(String); - /// The result type for layouting. -pub type LayoutResult<T> = Result<T, LayoutError>; - -impl LayoutError { - /// Create a new layout error with a message. - pub fn new<S: Into<String>>(message: S) -> LayoutError { - LayoutError(message.into()) - } -} - -error_type! { - err: LayoutError, - show: f => f.write_str(&err.0), - from: (std::io::Error, LayoutError::new(err.to_string())), - from: (FontError, LayoutError::new(err.to_string())), -} +pub type LayoutResult<T> = TypesetResult<T>; |
