1extern crate self as icydb_model;
8
9pub mod application;
10pub mod base;
11#[cfg(all(feature = "build", not(target_arch = "wasm32")))]
12pub mod build;
13pub mod error;
14#[cfg(all(feature = "build", not(target_arch = "wasm32")))]
15pub mod fragment;
16#[cfg(all(feature = "build", not(target_arch = "wasm32")))]
17pub mod node;
18pub mod normalize;
19#[cfg(all(feature = "build", not(target_arch = "wasm32")))]
20mod schema_validate;
21mod typed_adapter;
22pub mod types;
23pub mod validate;
24#[cfg(all(feature = "build", not(target_arch = "wasm32")))]
25mod visit;
26pub mod visitor;
27
28#[cfg(all(feature = "build", not(target_arch = "wasm32")))]
29use crate::{build::BuildError, node::NodeError};
30#[cfg(all(feature = "build", not(target_arch = "wasm32")))]
31use thiserror::Error as ThisError;
32
33pub mod prelude {
35 #[cfg(all(feature = "build", not(target_arch = "wasm32")))]
36 pub(crate) use crate::build::schema_read;
37 #[cfg(all(feature = "build", not(target_arch = "wasm32")))]
38 pub use crate::node::*;
39 pub use crate::{
40 EntitySource as _, Inner as _, NormalizeAndValidate as _, Path as _, base, canister,
41 entity, enum_, err,
42 error::ErrorTree,
43 list, map, newtype, normalizer, record,
44 schema::*,
45 set, store, tuple,
46 types::{Cardinality, Primitive},
47 validator,
48 visitor::{
49 Issue, Normalize as _, NormalizeAuto, NormalizeCustom, Normalizer as _, Validate as _,
50 ValidateAuto, ValidateCustom, Validator as _, Visitable as _, VisitorContext,
51 },
52 };
53 #[cfg(all(feature = "build", not(target_arch = "wasm32")))]
54 pub(crate) use crate::{
55 node::{MacroNode, ValidateNode, VisitableNode},
56 visit::Visitor,
57 };
58
59 pub use serde::{Deserialize, Serialize};
60}
61
62pub use application::NormalizeAndValidate;
63pub use icydb_model_macros::{
64 Add, AddAssign, Deref, DerefMut, Display, Div, DivAssign, Inner, Mul, MulAssign, Neg, Product,
65 Rem, RemAssign, Sub, SubAssign, Sum, canister, entity, enum_, list, map, newtype, normalizer,
66 record, set, store, tuple, validator,
67};
68pub use icydb_schema::MAX_INDEX_FIELDS;
69pub use normalize::normalize;
70#[doc(hidden)]
71pub use typed_adapter::{
72 TypedAdapterContext, TypedEnumDescriptor, TypedEnumSelection, TypedInputValue, TypedNamedType,
73 TypedOutputValue, TypedScalarValue, TypedValueError,
74};
75pub use validate::validate;
76
77pub trait Path {
79 const PATH: &'static str;
81}
82
83pub trait EntitySource {
89 const ENTITY: &'static str;
91}
92
93pub trait Inner<T> {
95 fn inner(&self) -> &T;
97
98 fn into_inner(self) -> T;
100}
101
102pub mod schema {
104 pub use icydb_schema::*;
105}
106
107#[doc(hidden)]
109pub mod __reexports {
110
111 #[cfg(all(feature = "build", not(target_arch = "wasm32")))]
112 pub use ctor;
113 pub use icydb_model_macros;
114 pub use remain;
115 pub use serde;
116}
117
118#[cfg(all(feature = "build", not(target_arch = "wasm32")))]
125#[derive(Debug, ThisError)]
126pub enum Error {
127 #[error(transparent)]
128 BuildError(#[from] BuildError),
129
130 #[error(transparent)]
131 NodeError(#[from] NodeError),
132}
133
134#[cfg(all(test, feature = "build", not(target_arch = "wasm32")))]
139mod tests;
140
141#[doc(hidden)]
143#[cfg(all(feature = "build", not(target_arch = "wasm32")))]
144#[macro_export]
145macro_rules! __icydb_register_schema {
146 ($($item:item)*) => { $($item)* };
147}
148
149#[doc(hidden)]
150#[cfg(not(all(feature = "build", not(target_arch = "wasm32"))))]
151#[macro_export]
152macro_rules! __icydb_register_schema {
153 ($($item:item)*) => {};
154}