gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

HTML 229Rust 8TOML 3CSS 1310 Definiciones

⎇ dbeebabc0785fabdade12c77fc684e0884494198 src/lib.rs Rust · 51 líneas · 1.0 KB Historia Quién tocó qué crudo

Vendor indexmap from heapless crate (#108) dbeebabc0 · colepoirier ·

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}