gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 1095HTML 1027Markdown 12TOML 84433 Definitions

⎇ b1287019ec991fe1c0653cd0484225959955c5ad src/lib.rs Rust · 46 lines · 913 B History Who touched what raw

cargo fmt 4740fe4a9 · Adam Nemecek ·

1#![cfg_attr(not(feature = "std"), no_std)]
2
3#[cfg(all(not(feature = "std"), feature = "alloc"))]
4extern crate alloc;
5
6#[cfg_attr(feature = "serde", macro_use)]
7#[cfg(feature = "serde")]
8extern crate serde;
9
10pub mod geometry;
11pub mod node;
12pub mod number;
13pub mod prelude;
14pub mod result;
15pub mod style;
16
17mod algo;
18mod forest;
19mod id;
20
21mod sys;
22
23pub use crate::node::Stretch;
24
25#[derive(Debug)]
26pub enum Error {
27    InvalidNode(node::Node),
28}
29
30#[cfg(feature = "std")]
31impl std::fmt::Display for Error {
32    fn fmt(&self, f: &mut std::fmt::Formatter) -> std::fmt::Result {
33        match *self {
34            Error::InvalidNode(ref node) => write!(f, "Invalid node {:?}", node),
35        }
36    }
37}
38
39#[cfg(feature = "std")]
40impl std::error::Error for Error {
41    fn description(&self) -> &str {
42        match *self {
43            Error::InvalidNode(_) => "The node is not part of the stretch instance",
44        }
45    }
46}