//! WASM and Native C/C++ bindings for the Modbus workspace.
//!
//! Provides both WASM browser bindings and native C FFI bindings for the modbus-rs stack.
//!
//! Browser-facing APIs (feature `wasm`, `wasm32` target only):
//! - `WasmModbusClient` for WebSocket/TCP gateway usage
//! - `WasmSerialModbusClient` for Web Serial (RTU/ASCII)
//! - `request_serial_port` and `WasmSerialPortHandle` helpers
//!
//! Native C FFI (feature `c`, non-wasm targets):
//! - `mbus_tcp_client_new` / `mbus_serial_client_new` — create clients, return an ID
//! - `mbus_tcp_poll` / `mbus_serial_poll` — drive the request/response state machine
//! - Per-operation request functions (coils, registers, discrete inputs, etc.)
//! - Response data delivered via C function-pointer callbacks in `MbusCallbacks`
#![cfg_attr(all(not(doc), not(has_unwind)), no_std)]
#![warn(missing_docs)]

#[cfg(all(not(doc), not(has_unwind)))]
use core::panic::PanicInfo;

#[cfg(all(not(doc), not(has_unwind)))]
#[panic_handler]
fn panic_handler(_info: &PanicInfo) -> ! {
    loop {}
}

// Pool configuration generated by build.rs from MBUS_MAX_TCP_CLIENTS and MBUS_MAX_SERIAL_CLIENTS env vars.
include!(concat!(env!("OUT_DIR"), "/pool_config.rs"));

#[cfg(target_arch = "wasm32")]
mod wasm;

#[cfg(target_arch = "wasm32")]
pub use wasm::WasmModbusClient;

#[cfg(target_arch = "wasm32")]
pub use wasm::{WasmSerialModbusClient, WasmSerialPortHandle, request_serial_port};

#[cfg(not(target_arch = "wasm32"))]
#[allow(missing_docs)]
pub mod c;
