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
//===================================================================================================================================================================================//
//
// /$$$$$$$ /$$
// | $$__ $$ | $$
// | $$ \ $$ /$$$$$$ /$$$$$$ /$$$$$$
// | $$$$$$$/ /$$__ $$ /$$__ $$|_ $$_/
// | $$__ $$| $$ \ $$| $$ \ $$ | $$
// | $$ \ $$| $$ | $$| $$ | $$ | $$ /$$
// | $$ | $$| $$$$$$/| $$$$$$/ | $$$$/
// |__/ |__/ \______/ \______/ \___/
//
//===================================================================================================================================================================================//
//?
//? Created by LunaticWyrm467 and others.
//?
//? All code is licensed under the MIT license.
//? Feel free to reproduce, modify, and do whatever.
//?
//!
//! An extendable system made up of autonomous execution services known as nodes organized in a tree of processes. Inspired by Godot!
//!
//! A simple node implementation will look like the following:
//! ```rust, ignore
//! use node_tree::prelude::*;
//!
//! class! {
//!
//! /// Documentation and attributes are supported!
//! pub declare NodeName extends UniqueTraitGroup1, UniqueTraitGroup2; // Will need to write a separate `impl` for each trait listed here.
//!
//! /// A signal can be connected to node functions and emitted.
//! /// Safety is guaranteed via the scene tree.
//! pub signal on_event(param_name: Type, ..);
//!
//! /// Constants are supported.
//! const SOME_CONST: &str = "Hello";
//!
//! /// Fields can be defined like so, with default or without default values.
//! let field_uninit: u8;
//! let field_initialized: String = "These are not constant expressions!".to_string();
//!
//! // Fields can have special attributes, like so:
//! default let field_default: u8; // Will automatically initialize to zero.
//! unique let field_unique: *mut c_void; // When cloned or serialized, this will safetly be initialized as a `None` value.
//!
//! // Exportable fields will be saved and loaded from whenever a node scene is serialized.
//! // Note: All exported types will need to implement the `Exportable` trait.
//! export let some_parameter: String;
//! export default let some_parameter_default: bool;
//!
//! // Hooks are any system functions that can be overridden.
//! // This include the constructor `_init()`, `loaded()`, `ready()`, `process()`, `terminal()`, and `process_mode()`.
//!
//! /// The constructor may only need to be implemented if there exists fields that do not have
//! /// a default value.
//! /// Note that this macro will automatically create a `new()` invokation, even without a
//! /// predefined `_init()` hook. All attributes given to this hook will be transferred to the
//! /// `new()` function.
//! hk _init(starter_value: u8) {
//!
//! // Initialize a value by creating a variable with the same field name:
//! let field_uninit: u8 = starter_value;
//! }
//!
//! /// Functions can be declared as per usual.
//! fn foo(bar: Type) -> Type {
//! todo!();
//! }
//! }
//! ```
pub use portable_intertrait as intertrait;
doctest!;