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}