typeface/
lib.rs

1//! Foundation for building and parsing fonts.
2
3#[macro_use]
4mod macros;
5
6pub mod tape;
7pub mod value;
8pub mod walue;
9
10mod number;
11
12pub use number::{q16, q32};
13
14/// An error.
15pub type Error = std::io::Error;
16
17/// An error caused by another error.
18#[derive(Debug)]
19pub struct ErrorWithSource {
20    pub description: String,
21    pub source: Error,
22}
23
24/// A result.
25pub type Result<T> = std::io::Result<T>;
26
27impl std::fmt::Display for ErrorWithSource {
28    fn fmt(&self, formatter: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
29        write!(formatter, "{}, due to {}", self.description, self.source)
30    }
31}
32
33impl std::error::Error for ErrorWithSource {
34    #[inline]
35    fn source(&self) -> Option<&(dyn std::error::Error + 'static)> {
36        Some(&self.source)
37    }
38}