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