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
//! # mavrouter
//!
//! High-performance, intelligent MAVLink router for embedded systems.
//!
//! ## Features
//!
//! - **Intelligent Routing**: Learns network topology, routes messages efficiently
//! - **Multi-Protocol**: TCP, UDP, Serial support
//! - **Reliability**: Automatic endpoint restart, deduplication, filtering
//! - **Performance**: 50ns routing lookup, 34kHz+ throughput tested
//!
//! ## Quick Start
//!
//! The simplest way to use mavrouter as a library is with the high-level [`Router`] API:
//!
//! ```no_run
//! use mavrouter::Router;
//!
//! # async fn example() -> Result<(), mavrouter::error::RouterError> {
//! // Start from a TOML string
//! let router = Router::from_str(r#"
//! [[endpoint]]
//! type = "udp"
//! address = "0.0.0.0:14550"
//! mode = "server"
//! "#).await?;
//!
//! // Or from a configuration file
//! // let router = Router::from_file("mavrouter.toml").await?;
//!
//! // Access the message bus to subscribe to messages
//! let mut rx = router.bus().subscribe();
//!
//! // ... do your work ...
//!
//! // Gracefully shut down
//! router.stop().await;
//! # Ok(())
//! # }
//! ```
//!
//! ## Configuration
//!
//! See [`config::Config`] for TOML configuration structure. You can also create
//! configurations programmatically using [`config::Config::parse`] or the
//! standard [`FromStr`](std::str::FromStr) trait.
//!
//! ## Re-exported Dependencies
//!
//! For convenience, commonly needed dependencies are re-exported:
//!
//! - [`CancellationToken`]: For graceful shutdown control
//! - [`RwLock`]: Used by the routing table (from `parking_lot`)
//!
//! ## Architecture
//!
//! - [`Router`]: High-level API for starting and managing the router
//! - [`router`]: Low-level message bus and routing primitives
//! - [`routing`]: Intelligent routing table
//! - [`endpoints`]: TCP/UDP/Serial endpoint implementations
//! - [`filter`]: Per-endpoint message filtering
//! - [`config`]: Configuration parsing and validation
// Enforce 100% documentation coverage
/// Router configuration and parsing utilities.
/// Core logic for generic endpoint operations.
/// Custom error types for structured error handling.
/// Core message routing logic and types.
/// Various MAVLink endpoint implementations (TCP, UDP, Serial, TLOG).
/// Message deduplication logic.
/// Message filtering capabilities for endpoints.
/// MAVLink message framing and parsing from byte streams.
/// Utility functions for MAVLink message processing.
/// Routing table implementation for MAVLink messages.
/// Statistics history tracking and aggregation.
// Re-export commonly needed dependencies for library users.
// This allows users to avoid adding these as direct dependencies
// and ensures version compatibility.
/// Re-export of `tokio_util::sync::CancellationToken` for graceful shutdown control.
pub use CancellationToken;
/// Re-export of `parking_lot::RwLock` used by the routing table.
pub use RwLock;
// Re-export the high-level Router API at crate root for convenience.
pub use Router;