Vendor indexmap from heapless crate (#108)
1#![cfg_attr(not(feature = "std"), no_std)]
2#![deny(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(all(not(feature = "alloc"), not(feature = "std")))]
23mod indexmap;
24
25#[cfg(feature = "std")]
26use core::fmt::{Display, Formatter, Result};
27
28pub use crate::node::Sprawl;
29
30#[derive(Debug)]
31pub enum Error {
32 InvalidNode(node::Node),
33}
34
35#[cfg(feature = "std")]
36impl Display for Error {
37 fn fmt(&self, f: &mut Formatter) -> Result {
38 match *self {
39 Error::InvalidNode(ref node) => write!(f, "Invalid node {:?}", node),
40 }
41 }
42}
43
44#[cfg(feature = "std")]
45impl std::error::Error for Error {
46 fn description(&self) -> &str {
47 match *self {
48 Error::InvalidNode(_) => "The node is not part of the sprawl instance",
49 }
50 }
51}