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/// Total, verified layout plan: a coverage-checked projection from
43/// [`document::EureDocument`] to [`source::SourceDocument`].
44pub mod plan;
45/// Source-level document representation with layout metadata.
46///
47/// Used for programmatic construction of Eure documents with preserved
48/// formatting information (comments, section ordering, etc.).
49pub mod source;
50
51/// Macro for building Eure documents.
52mod eure_macro;
53
54pub mod map;
55
56/// Zero-sized types for compile-time literal matching in `FromEure`.
57pub mod must_be;
58
59/// Proxy types for use with `#[eure(via = "...")]` attribute.
60pub mod proxy;
61
62pub(crate) mod prelude_internal {
63    #![allow(unused_imports)]
64    #![allow(deprecated)]
65    pub use crate::data_model::*;
66    pub use crate::document::constructor::DocumentConstructor;
67    pub use crate::document::node::{Node, NodeMap, NodeMut, NodeValue};
68    pub use crate::document::{EureDocument, InsertError, InsertErrorKind, NodeId};
69    pub use crate::eure;
70    pub use crate::identifier::Identifier;
71    pub use crate::map::Map;
72    pub use crate::path::{ArrayIndexKind, EurePath, PathSegment};
73    pub use crate::text::{Language, SyntaxHint, Text, TextParseError};
74    pub use crate::value::{ObjectKey, PrimitiveValue};
75    pub use alloc::boxed::Box;
76    pub use alloc::{string::String, string::ToString, vec, vec::Vec};
77    pub use thisisplural::Plural;
78}
79
80impl IntoEure for regex::Regex {
81    type Error = write::WriteError;
82
83    fn write(value: Self, c: &mut constructor::DocumentConstructor) -> Result<(), Self::Error> {
84        c.write(value.as_str())
85    }
86}