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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
//! # Rust bindings generator for MAVSpec
//!
//! <span style="font-size:24px">[πΊπ¦](https://mavka.gitlab.io/home/a_note_on_the_war_in_ukraine/)</span>
//! [](https://gitlab.com/mavka/libs/mavspec)
//! [](https://crates.io/crates/mavspec)
//! [](https://docs.rs/mavspec/latest/mavspec/)
//! [](https://gitlab.com/mavka/libs/mavspec/-/issues/)
//!
//! This module contains Rust bindings for [MAVSpec](https://gitlab.com/mavka/libs/mavspec), a code generation
//! toolchain for [MAVLink](https://mavlink.io/en/) protocol.
//!
//! # Usage
//!
//! We provide a [`BuildHelper`] that can be integrated into your build pipeline.
//!
//! ```rust
//! # use std::fs::remove_dir_all;
//! use mavspec::rust::gen::BuildHelper;
//!
//! // Paths to XML definitions directories.
//! let sources = vec![
//! "./message_definitions/standard",
//! "./message_definitions/extra",
//! ];
//! // Output path
//! let destination = "../tmp/mavlink";
//! # let destination = "../tmp/mavlink/lib/default";
//!
//! // Generate rust bindings
//! BuildHelper::builder(destination)
//! .set_sources(&sources)
//! # .set_include_dialects(&["minimal"])
//! .generate()
//! .unwrap();
//! # remove_dir_all(destination).unwrap_or_default();
//! ```
//!
//! For better control over included dialects you may directly pass `Protocol` from
//! [MAVInspect](https://gitlab.com/mavka/libs/mavinspect)'s `Inspector`.
//!
//! ```rust
//! # use std::fs::remove_dir_all;
//! use std::path::Path;
//! use mavspec::rust::gen::BuildHelper;
//! use mavinspect::Inspector;
//!
//! // Paths to XML definitions directories.
//! let sources = vec![
//! "./message_definitions/standard",
//! "./message_definitions/extra",
//! ];
//!
//! // Parse XML definitions
//! let protocol = Inspector::builder()
//! // Define paths to XML definitions directories
//! .set_sources(&sources)
//! # .set_include(&["minimal"])
//! // Build configuration and parse dialects
//! .build().unwrap()
//! .parse().unwrap();
//!
//! // Output path
//! let destination = "../tmp/mavlink";
//! # let destination = "../tmp/mavlink/lib/from_protocol";
//!
//! // Generate rust bindings
//! BuildHelper::builder(destination)
//! .set_protocol(protocol)
//! .generate()
//! .unwrap();
//! # remove_dir_all(destination).unwrap_or_default();
//! ```
//!
//! # Naming Conventions
//!
//! In `MAVSpec` we are trying to keep balance between names as they appear in MAVLink XML definitions and Rust naming
//! conventions. In most situation we favor the Rust way unless it introduces confusions. In case we failed, and you are
//! confused, all entities are supplemented with descriptions where canonical MAVlink names are mentioned. Here is the list
//! of the naming rules:
//!
//! * For **structs** and **enums** `MAVSpec` uses `UpperCamelCase`.
//! * For **message fields** we use `snake_case`.
//! * For **enum entries** (enum entries) we use `UpperCamelCase` with MAVLink enum name prefix stripped
//! (whenever applicable). For example, if bitmask enum has name `IMPORTANCE_LEVEL` and flag name is
//! `IMPORTANCE_LEVEL_THE_MATTER_OF_LIFE_AND_DEATH`, then flag name will be `TheMatterOfLifeAndDeath`.
//! * For **bitmask flags** (enum entries for enums which are bitmasks) we use `SCREAMING_SNAKE_CASE` with MAVLink enum name
//! prefix stripped (whenever applicable). For example, if bitmask enum has name `VERY_IMPORTANT_FLAGS` and flag name is
//! `VERY_IMPORTANT_FLAGS_THE_MATTER_OF_LIFE_AND_DEATH_FLAG`, then flag name will be `THE_MATTER_OF_LIFE_AND_DEATH_FLAG`.
//! * In the case of collision with rust keywords, we add underscore suffix. For example, `type` field of `HEARTBEAT`
//! message will be encoded as `type_`.
//! * In the rare cases when symbolic name starts with numeric character, it will be prefixed with `_`.
//!
//! The last two cases of handling inconvenient names are not something of high aesthetic value but in our defence we
//! must say that all approaches we've considered looked equally ugly.
//!
//! # Fingerprints
//!
//! MAVInspect may skip code re-generation if dialects haven't changed. It uses 64-bit CRC fingerprint to monitor
//! changes. Set `fingerprints` feature flag to enable this behavior.
//!
//! This feature is useful for reducing build time during development and CI runs. Make sure that your releases are
//! clean and do not depend on fingerprints.
//!
//! # Unstable Features
//!
//! Unstable features are enabled by `unstable` feature flag. Such features are experimental and can be changed or
//! excluded in future releases.
pub use ;
pub
pub use ;
pub
pub
pub
pub