//! **MAVInspect** is a library for parsing MAVLink
//! [message definitions](https://github.com/mavlink/mavlink/tree/master/message_definitions/v1.0).
//!
//! [`repository`](https://gitlab.com/mavka/libs/mavinspect)
//! [`crate`](https://crates.io/crates/mavinspect)
//! [`API docs`](https://docs.rs/mavinspect/latest/mavinspect/)
//!
//! # Usage
//!
//! Let's use [`XMLInspector`] to discover and parse MAVLink XML.
//!
//! ```rust
//! use std::env;
//! use mavinspect::parser::XMLInspector;
//!
//! // Instantiate inspector and load XML definitions from several locations
//! let inspector = XMLInspector::builder()
//!     .set_sources(&[
//!         "./message_definitions/standard",
//!         "./message_definitions/extra",
//!     ])
//!     .build()
//!     .unwrap();
//!   
//! // Parse all XML definitions
//! let protocol = inspector.parse().unwrap();
//!   
//! // Get `crazyflight` custom dialect
//! let crazyflight = protocol.dialects().get("crazy_flight").unwrap();
//!
//! // Get `DUMMYFLIGHT_OUTCRY` message
//! let outcry_message = crazyflight.messages().get(&54000u32).unwrap();
//! assert_eq!(outcry_message.name(), "CRAZYFLIGHT_OUTCRY");
//! println!("\n`CRAZYFLIGHT_OUTCRY` message: {:#?}", outcry_message);
//! ```
//!
//! Here we obtain an instance of [`Protocol`](protocol::Protocol) that contains a collection of
//! dialects. Each [`Dialect`](protocol::Dialect) contains MAVLink [`enums`](protocol::Dialect::enums) and
//! [`messages`](protocol::Dialect::messages) as well as additional information (like version or dependencies).
//!
//! # Cargo Features
//!
//! * `serde` — add [Serde](https://serde.rs) support.
//!
//! # Specification API
//!
//! MAVLink entities are defined in the [`protocol`] module. The root of the specification is
//! [`Protocol`](protocol::Protocol) struct that contains [`Dialects`](protocol::Dialect). The latter contains dialect
//! metadata, [`messages`](protocol::Dialect::messages) and [`enums`](protocol::Dialect::enums).
//!
//! Most of the entities with complex validation rules and lots of parameters are using
//! [builder](https://rust-unofficial.github.io/patterns/patterns/creational/builder.html) instead of direct
//! instantiation (no constructors). We assume that library clients prefer to use XML definitions as a ground truth for
//! their dialects and are not very interested in manual creation of Rust entities. However, this possibility remains
//! open yet not encouraged.
//!
//! All entities optionally support [Serde](https://serde.rs) and are thread-safe.
//!
//! # Errors
//!
//! Library is designed to not to panic. All errors a variants (or sub-variants) of [`Error`](errors::Error). Fallible
//! functions and methods return [`Result`] type.

#![warn(missing_docs)]
#![deny(rustdoc::broken_intra_doc_links)]
#![doc(
    html_logo_url = "https://gitlab.com/mavka/libs/mavinspect/-/raw/main/avatar.png?ref_type=heads",
    html_favicon_url = "https://gitlab.com/mavka/libs/mavinspect/-/raw/main/avatar.png?ref_type=heads"
)]

pub mod parser;
#[doc(inline)]
pub use parser::XMLInspector;

pub mod errors;
pub mod protocol;
pub mod utils;
