Skip to main content

eure_document/
lib.rs

1#![no_std]
2extern crate alloc;
3
4#[cfg(feature = "std")]
5extern crate std;
6
7// Re-export commonly used types for eure! macro users
8pub use text::Text;
9
10/// A data structure for representing a Eure document without any span information.
11pub mod tree;
12
13/// Identifier type and parser.
14pub mod identifier;
15
16/// Unified text type for strings and code.
17pub mod text;
18
19/// A type-safe data-type of Eure data-model.
20pub mod value;
21
22/// A data structure for representing a Eure document including extensions.
23pub mod document;
24
25// Re-export constructor at the root for macro compatibility with `#[eure(crate = ::eure_document)]`
26pub use document::constructor;
27
28use crate::write::IntoEure;
29
30/// Data structure for representing a path in a Eure document.
31pub mod path;
32
33/// Data structure for representing a data-model of Eure.
34pub mod data_model;
35
36/// Trait for parsing Rust types from Eure documents.
37pub mod parse;
38
39/// Trait for writing Rust types to Eure documents.
40pub mod write;
41
42/// Deterministic layout for Eure documents.
43pub mod layout;
44/// Source-level document representation with layout metadata.
45///
46/// Used for programmatic construction of Eure documents with preserved
47/// formatting information (comments, section ordering, etc.).
48pub mod source;
49
50/// Macro for building Eure documents.
51mod eure_macro;
52
53pub mod map;
54
55/// Zero-sized types for compile-time literal matching in `FromEure`.
56pub mod must_be;
57
58/// Proxy types for use with `#[eure(via = "...")]` attribute.
59pub mod proxy;
60
61pub(crate) mod prelude_internal {
62    #![allow(unused_imports)]
63    #![allow(deprecated)]
64    pub use crate::data_model::*;
65    pub use crate::document::constructor::DocumentConstructor;
66    pub use crate::document::node::{Node, NodeMap, NodeMut, NodeValue};
67    pub use crate::document::{EureDocument, InsertError, InsertErrorKind, NodeId};
68    pub use crate::eure;
69    pub use crate::identifier::Identifier;
70    pub use crate::map::Map;
71    pub use crate::path::{EurePath, PathSegment};
72    pub use crate::text::{Language, SyntaxHint, Text, TextParseError};
73    pub use crate::value::{ObjectKey, PrimitiveValue};
74    pub use alloc::boxed::Box;
75    pub use alloc::{string::String, string::ToString, vec, vec::Vec};
76    pub use thisisplural::Plural;
77}
78
79impl IntoEure for regex::Regex {
80    type Error = write::WriteError;
81
82    fn write(value: Self, c: &mut constructor::DocumentConstructor) -> Result<(), Self::Error> {
83        c.write(value.as_str())
84    }
85}