gioser

tawasuyu/taffy

A high performance rust-powered UI layout library

Rust 499HTML 254C 19JavaScript 81365 Definitions

⎇ 5dde45d200e154a0f084780d575035dbb01599e4 src/lib.rs Rust · 49 lines · 974 B History Who touched what raw

Rename `sprawl::node::Stretch` -> `sprawl::node::Sprawl` (#79) 7c3259899 · Andreas Weibye ·

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::Sprawl;
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 sprawl instance",
47        }
48    }
49}