aboutsummaryrefslogtreecommitdiff
path: root/mingling_core/src/lib.rs
blob: 14559eda387db9419c31266f077b1f63f3c501a6 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
//! Mingling Core
//!
//! # Intro
//! This crate is the core implementation of `mingling`, containing the complete logic for command dispatching, execution, and rendering.
//!
//! # Note
//! It is not recommended to use [mingling_core](https://crates.io/crates/mingling_core) directly, as this will lose the code generation functionality of [mingling_macros](https://crates.io/crates/mingling_macros).
//!
//! Recommended to import [mingling](https://crates.io/crates/mingling) to use its features.

mod any;
mod asset;
mod program;
mod renderer;
mod tester;

/// Provides a toolkit for `Mingling` testing capabilities.
pub mod test {
    pub use crate::tester::*;
}

#[cfg(feature = "structural_renderer")]
pub use crate::renderer::structural::StructuralRenderer;

// NOT re-exported at top level: the `StructuralData` trait is sealed and only
// accessible through the derive macro. Users who need the trait can access it
// via `mingling::renderer::structural::StructuralData` (through the inner alias).
pub use crate::any::group::*;
pub use crate::any::*;

pub use crate::asset::chain::*;
pub use crate::asset::dispatcher::*;
pub use crate::asset::enum_tag::*;
pub use crate::asset::global_resource::*;
pub use crate::asset::help::*;
pub use crate::asset::lazy_resource::*;
pub use crate::asset::node::*;
pub use crate::asset::renderer::*;

/// All error types of `Mingling`
pub mod error {
    pub use crate::asset::chain::error::*;
    pub use crate::exec::error::*;
    pub use crate::program::error::*;
    #[cfg(feature = "structural_renderer")]
    pub use crate::renderer::structural::error::*;
    #[cfg(feature = "pathf")]
    pub use mingling_pathf::error::*;
}

pub use crate::program::*;

pub use crate::renderer::render_result::*;

#[cfg(feature = "builds")]
#[doc(hidden)]
pub mod builds;

/// Provides build scripts for users
#[cfg(feature = "builds")]
pub mod build {
    #[cfg(feature = "comp")]
    pub use crate::builds::comp::*;
}

/// Provided for framework developers
pub mod debug;

#[cfg(feature = "comp")]
#[doc(hidden)]
pub mod comp;

#[cfg(feature = "comp")]
pub use crate::comp::*;

pub mod setup {
    pub use crate::program::setup::ProgramSetup;
}

/// Private API — not intended for direct use.
#[doc(hidden)]
pub mod __private {
    /// Sealed trait for `StructuralData` — only implementable via derive macro.
    pub trait StructuralDataSealed {}

    /// Re-export so the derive macro can reference the trait without
    /// conflicting with the derive macro name at `::mingling::StructuralData`.
    #[cfg(feature = "structural_renderer")]
    pub use crate::renderer::structural::structural_data::StructuralData;
}

#[doc(hidden)]
pub mod core_res {
    #[cfg(feature = "repl")]
    pub use crate::program::repl_exec::res::ResREPL;
}

#[cfg(feature = "pathf")]
pub mod pathf {
    pub use mingling_pathf::config::*;
    pub use mingling_pathf::module_pathf::*;
    pub use mingling_pathf::pattern_analyzer::*;
    pub use mingling_pathf::patterns::*;

    pub use mingling_pathf::analyze_and_build_type_mapping;

    use std::path::Path;

    /// Wraps `analyze_and_build_type_mapping_for` with config derived from
    /// the crate's feature flags (e.g., `dispatch_tree`).
    pub fn analyze_and_build_type_mapping_for(
        crate_dir: &Path,
        output_dir: &Path,
    ) -> Result<(), crate::error::MinglingPathfinderError> {
        let config = mingling_pathf::config::PathfinderConfig {
            use_dispatch_tree: cfg!(feature = "dispatch_tree"),
        };
        mingling_pathf::analyze_and_build_type_mapping_for(crate_dir, output_dir, &config)
    }
}