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
//!
//! ```rust,ignore
//! use infinity_bridge_wasm::{Bridge, BridgeConfig, CommBusBackend};
//! use serde_json::{json, Value};
//!
//! // Implement CommBusBackend for your MSFS SDK bindings
//! struct MyCommBus;
//! impl CommBusBackend for MyCommBus {
//! type Error = String;
//! type Subscription = MySubscription;
//!
//! fn subscribe(
//! event: &str,
//! callback: impl Fn(&str) + 'static,
//! ) -> Result<Self::Subscription, Self::Error> {
//! // ... wire to msfs::comm_bus
//! }
//!
//! fn call(event: &str, data: &str) -> Result<(), Self::Error> {
//! // ... wire to msfs::comm_bus::call
//! }
//! }
//!
//! let bridge = Bridge::<MyCommBus>::new(
//! BridgeConfig::new("myaddon/bridge_call", "myaddon/bridge_resp"),
//! |name, payload| {
//! match name {
//! Some("get_state") => Ok(json!({"temp": 42})),
//! _ => Err("unknown command".into()),
//! }
//! },
//! )?;
//!
//! // Fire-and-forget event to host
//! bridge.emit("state_changed", json!({"phase": "cruise"}))?;
//! ```
pub use CommBusBackend;
pub use ;
pub use ;