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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
//! 
//!
//! **Universal Embedded CRDTs for Distributed Coordination**
//!
//! CRDTosphere is a comprehensive `no_std` Rust library implementing Conflict-free Replicated Data Types (CRDTs)
//! optimized for embedded systems. It provides ultra-efficient, configurable CRDT implementations for automotive,
//! robotics, IoT, and industrial applications across multiple platforms.
//!
//! ## Features
//!
//! - **Universal Platform Support** - AURIX, STM32, ARM Cortex-M, RISC-V
//! - **Configurable Memory** - 2KB to 1MB+ budgets with compile-time verification
//! - **Multi-Domain Ready** - Automotive, robotics, IoT, industrial applications
//! - **Safety Critical** - ISO 26262, IEC 61508, DO-178C compliance support
//! - **Ultra-Efficient** - 5-100 byte CRDT instances with hardware optimizations
//! - **No Dynamic Allocation** - Pure static allocation for deterministic behavior
//! - **Real-Time Guarantees** - Bounded execution time (<1000 CPU cycles)
//!
//! ## Feature Overview
//!
//! ### Domain-Specific Features
//! - [`automotive`] - Automotive ECU and safety-critical systems (ISO 26262, ASIL-D)
//! - [`robotics`] - Robotics and autonomous systems coordination
//! - [`iot`] - Internet of Things and sensor networks
//! - [`industrial`] - Industrial automation and control systems
//!
//! ### Platform-Specific Features - **Mostly mutually exclusive**
//! - `aurix` - AURIX TriCore automotive MCUs (multi-core, safety features)
//! - `stm32` - STM32 ARM Cortex-M MCUs (power management optimizations)
//! - `cortex-m` - Generic ARM Cortex-M platforms (memory constrained)
//! - `riscv` - RISC-V embedded processors (variable multi-core)
//!
//! ### Hardware Optimization Features
//! - `hardware` - Enable all hardware optimizations
//! - `hardware-atomic` - Hardware atomic operations for thread safety
//!
//! ### Serialization Features
//! - `serde` - Serde serialization support (no_std compatible)
//!
//! ## Platform Support Matrix
//!
//! | Feature | AURIX | STM32 | Cortex-M | RISC-V | Default |
//! |---------|-------|-------|----------|--------|---------|
//! | **Memory Alignment** | 32-byte | 4-byte | 4-byte | 8-byte | 4-byte |
//! | **Max Merge Cycles** | 500 | 200 | 100 | 300 | 150 |
//! | **Multi-core** | ✅ (3 cores) | ❌ | ❌ | ✅ (variable) | ❌ |
//! | **Safety Features** | ✅ ASIL-D | ❌ | ❌ | ❌ | ❌ |
//! | **Power Management** | ❌ | ✅ | ✅ | ❌ | ❌ |
//! | **Real-Time Bounds** | ✅ (100μs) | ✅ (50μs) | ✅ (25μs) | ✅ (30μs) | ✅ (40μs) |
//!
//! **Note**: Platform features are mutually exclusive. Choose one per build.
//!
//! ## Platform-Specific Usage Examples
//!
//! ### AURIX TriCore (Automotive Safety-Critical)
//! ```toml
//! [dependencies]
//! crdtosphere = { version = "0.1", features = ["automotive", "aurix", "hardware-atomic"] }
//! ```
//!
//! ### STM32 (IoT/Industrial)
//! ```toml
//! [dependencies]
//! crdtosphere = { version = "0.1", features = ["iot", "stm32", "serde"] }
//! ```
//!
//! ### Generic Cortex-M (Robotics)
//! ```toml
//! [dependencies]
//! crdtosphere = { version = "0.1", features = ["robotics", "cortex-m"] }
//! ```
//!
//! ### RISC-V (Research/Custom)
//! ```toml
//! [dependencies]
//! crdtosphere = { version = "0.1", features = ["industrial", "riscv", "hardware-atomic"] }
//! ```
//!
//! ## Quick Start
//!
//! ```rust
//! use crdtosphere::prelude::*;
//!
//! // Define memory configuration for your platform
//! define_memory_config! {
//! name: MyPlatformConfig,
//! total_memory: 32 * 1024, // 32KB budget
//! max_registers: 100,
//! max_counters: 50,
//! max_sets: 20,
//! max_maps: 10,
//! max_nodes: 32,
//! }
//!
//! fn example() -> Result<(), CRDTError> {
//! // Use configurable CRDTs
//! let mut sensor_reading = LWWRegister::<i16, MyPlatformConfig>::new(1);
//! sensor_reading.set(42, 1000)?; // 1000 is your timestamp here.
//!
//! // Automatic conflict resolution
//! let other_node_reading = LWWRegister::<i16, MyPlatformConfig>::new(2);
//! sensor_reading.merge(&other_node_reading)?;
//! Ok(())
//! }
//! ```
//!
//! ## CRDT Types Available
//!
//! ### Counters
//! - [`GCounter`] - Grow-only counter (increment only)
//! - [`PNCounter`] - Increment/decrement counter
//!
//! ### Registers
//! - [`LWWRegister`] - Last-Writer-Wins register
//! - [`MVRegister`] - Multi-Value register (concurrent writes preserved)
//!
//! ### Sets
//! - [`GSet`] - Grow-only set (add only)
//! - [`ORSet`] - Observed-Remove set (add and remove)
//!
//! ### Maps
//! - [`LWWMap`] - Last-Writer-Wins map
//!
//!
//! [`GCounter`]: crate::counters::GCounter
//! [`PNCounter`]: crate::counters::PNCounter
//! [`LWWRegister`]: crate::registers::LWWRegister
//! [`MVRegister`]: crate::registers::MVRegister
//! [`GSet`]: crate::sets::GSet
//! [`ORSet`]: crate::sets::ORSet
//! [`LWWMap`]: crate::maps::LWWMap
// Core infrastructure modules
// Core CRDT modules (always available)
// Domain-specific CRDT modules
// Configuration presets
/// Prelude module of CRDTosphere
///
/// Convenient re-exports for common CRDTosphere types and traits