tawasuyu

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 501HTML 254C 19JavaScript 81414 Definitions

⎇ 8f72a707eb069d7d324096c7405b383f8245f25d src/lib.rs Rust · 48 lines · 969 B History Who touched what raw

Rename modules (#95) 8f72a707e · Alice Cecile ·

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