Summary
Remove the closed for_each_streamable() dispatcher from aimdb-data-contracts and add .register::<T>() builder methods to connectors/adapters. Publish aimdb-data-contracts to crates.io so users can depend on it for traits and built-in types. This unblocks crates.io publishing for aimdb-websocket-connector and aimdb-wasm-adapter.
Problem
The current for_each_streamable() in aimdb-data-contracts is a closed registry hardcoded to 3 built-in types (Temperature, Humidity, GpsLocation). This causes two issues:
- Users can't register custom contracts. A user-defined
MyCustomSensor: Streamable is invisible to the WebSocket connector and WASM adapter — the dispatcher never discovers it.
- crates.io publishing blocked.
aimdb-websocket-connector and aimdb-wasm-adapter depend on aimdb-data-contracts (not published) solely for the dispatcher function.
Proposed Solution
- Remove
for_each_streamable() and StreamableVisitor from aimdb-data-contracts (breaking)
- Add
.register::<T: Streamable>() builder method to WebSocketConnector, WsBridge, and WasmDb
- Publish
aimdb-data-contracts to crates.io — traits and built-in types available to all users
- Remove
aimdb-data-contracts dependency from aimdb-websocket-connector and aimdb-wasm-adapter
- Add version constraints to
aimdb-websocket-connector's path-only deps
All traits (SchemaType, Streamable, Linkable, Simulatable) stay in aimdb-data-contracts — no code moves to aimdb-core.
User-facing API after change
use aimdb_data_contracts::contracts::{Temperature, Humidity, GpsLocation};
let ws = WebSocketConnector::new()
.register::<Temperature>()
.register::<Humidity>()
.register::<GpsLocation>()
.register::<MyCustomSensor>() // user's own type
.register::<MyActuatorCommand>() // another custom type
.bind("0.0.0.0:8080")
.path("/ws");
Breaking Changes
for_each_streamable() and StreamableVisitor removed from aimdb-data-contracts
WebSocketConnector no longer auto-discovers types — users must .register::<T>() every type they need
WsBridge / WasmDb same — explicit .register::<T>() required
Summary
Remove the closed
for_each_streamable()dispatcher fromaimdb-data-contractsand add.register::<T>()builder methods to connectors/adapters. Publishaimdb-data-contractsto crates.io so users can depend on it for traits and built-in types. This unblocks crates.io publishing foraimdb-websocket-connectorandaimdb-wasm-adapter.Problem
The current
for_each_streamable()inaimdb-data-contractsis a closed registry hardcoded to 3 built-in types (Temperature,Humidity,GpsLocation). This causes two issues:MyCustomSensor: Streamableis invisible to the WebSocket connector and WASM adapter — the dispatcher never discovers it.aimdb-websocket-connectorandaimdb-wasm-adapterdepend onaimdb-data-contracts(not published) solely for the dispatcher function.Proposed Solution
for_each_streamable()andStreamableVisitorfromaimdb-data-contracts(breaking).register::<T: Streamable>()builder method toWebSocketConnector,WsBridge, andWasmDbaimdb-data-contractsto crates.io — traits and built-in types available to all usersaimdb-data-contractsdependency fromaimdb-websocket-connectorandaimdb-wasm-adapteraimdb-websocket-connector's path-only depsAll traits (
SchemaType,Streamable,Linkable,Simulatable) stay inaimdb-data-contracts— no code moves toaimdb-core.User-facing API after change
Breaking Changes
for_each_streamable()andStreamableVisitorremoved fromaimdb-data-contractsWebSocketConnectorno longer auto-discovers types — users must.register::<T>()every type they needWsBridge/WasmDbsame — explicit.register::<T>()required