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