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 node;
13pub mod number;
14pub mod prelude;
15pub mod result;
16pub mod style;
17
18mod algo;
19mod forest;
20mod id;
21mod sys;
22
23#[cfg(feature = "std")]
24use core::fmt::{Display, Formatter, Result};
25
26pub use crate::node::Stretch;
27
28#[derive(Debug)]
29pub enum Error {
30 InvalidNode(node::Node),
31}
32
33#[cfg(feature = "std")]
34impl Display for Error {
35 fn fmt(&self, f: &mut Formatter) -> Result {
36 match *self {
37 Error::InvalidNode(ref node) => write!(f, "Invalid node {:?}", node),
38 }
39 }
40}
41
42#[cfg(feature = "std")]
43impl std::error::Error for Error {
44 fn description(&self) -> &str {
45 match *self {
46 Error::InvalidNode(_) => "The node is not part of the stretch instance",
47 }
48 }
49}