Skip to content
Snippets Groups Projects
Commit c493beb3 authored by Federico Lolli's avatar Federico Lolli
Browse files

Added rust bindings (this will be auto generated in build.rs)

parent d01ce218
No related branches found
No related tags found
1 merge request!23Draft: Rust implementation
...@@ -2,6 +2,254 @@ ...@@ -2,6 +2,254 @@
# It is not intended for manual editing. # It is not intended for manual editing.
version = 3 version = 3
[[package]]
name = "autocfg"
version = "1.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa"
[[package]]
name = "bitflags"
version = "2.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed570934406eb16438a4e976b1b4500774099c13b8cb96eec99f620f05090ddf"
[[package]]
name = "byteorder"
version = "1.5.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b"
[[package]]
name = "crc-any"
version = "2.4.4"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "c01a5e1f881f6fb6099a7bdf949e946719fd4f1fefa56264890574febf0eb6d0"
[[package]]
name = "ioctl-rs"
version = "0.1.6"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f7970510895cee30b3e9128319f2cefd4bde883a39f38baa279567ba3a7eb97d"
dependencies = [
"libc",
]
[[package]]
name = "lazy_static"
version = "1.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646"
[[package]]
name = "libc"
version = "0.2.153"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c198f91728a82281a64e1f4f9eeb25d82cb32a5de251c6bd1b5154d63a8e7bd"
[[package]]
name = "mavlink-bindgen"
version = "0.1.0"
source = "git+https://github.com/mavlink/rust-mavlink.git#ad39b2847e84ec2ec17fa5c1b551b8db05f28243"
dependencies = [
"crc-any",
"lazy_static",
"proc-macro2",
"quick-xml",
"quote",
"thiserror",
]
[[package]]
name = "mavlink-core"
version = "0.12.2"
source = "git+https://github.com/mavlink/rust-mavlink.git#ad39b2847e84ec2ec17fa5c1b551b8db05f28243"
dependencies = [
"byteorder",
"crc-any",
"serde",
"serde_arrays",
"serial",
]
[[package]] [[package]]
name = "mavlink_rust" name = "mavlink_rust"
version = "0.1.0" version = "0.1.0"
dependencies = [
"bitflags",
"mavlink-bindgen",
"mavlink-core",
"num-derive",
"num-traits",
"serde",
]
[[package]]
name = "memchr"
version = "2.7.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149"
[[package]]
name = "num-derive"
version = "0.4.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ed3955f1a9c7c0c15e092f9c887db08b1fc683305fdf6eb6684f22555355e202"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "num-traits"
version = "0.2.18"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "da0df0e5185db44f69b44f26786fe401b6c293d1907744beaa7fa62b2e5a517a"
dependencies = [
"autocfg",
]
[[package]]
name = "proc-macro2"
version = "1.0.78"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e2422ad645d89c99f8f3e6b88a9fdeca7fabeac836b1002371c4367c8f984aae"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quick-xml"
version = "0.26.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7f50b1c63b38611e7d4d7f68b82d3ad0cc71a2ad2e7f61fc10f1328d917c93cd"
dependencies = [
"memchr",
]
[[package]]
name = "quote"
version = "1.0.35"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef"
dependencies = [
"proc-macro2",
]
[[package]]
name = "serde"
version = "1.0.197"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3fb1c873e1b9b056a4dc4c0c198b24c3ffa059243875552b2bd0933b1aee4ce2"
dependencies = [
"serde_derive",
]
[[package]]
name = "serde_arrays"
version = "0.1.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "38636132857f68ec3d5f3eb121166d2af33cb55174c4d5ff645db6165cbef0fd"
dependencies = [
"serde",
]
[[package]]
name = "serde_derive"
version = "1.0.197"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7eb0b34b42edc17f6b7cac84a52a1c5f0e1bb2227e997ca9011ea3dd34e8610b"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "serial"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a1237a96570fc377c13baa1b88c7589ab66edced652e43ffb17088f003db3e86"
dependencies = [
"serial-core",
"serial-unix",
"serial-windows",
]
[[package]]
name = "serial-core"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f46209b345401737ae2125fe5b19a77acce90cd53e1658cda928e4fe9a64581"
dependencies = [
"libc",
]
[[package]]
name = "serial-unix"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "f03fbca4c9d866e24a459cbca71283f545a37f8e3e002ad8c70593871453cab7"
dependencies = [
"ioctl-rs",
"libc",
"serial-core",
"termios",
]
[[package]]
name = "serial-windows"
version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "15c6d3b776267a75d31bbdfd5d36c0ca051251caafc285827052bc53bcdc8162"
dependencies = [
"libc",
"serial-core",
]
[[package]]
name = "syn"
version = "2.0.52"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b699d15b36d1f02c3e7c69f8ffef53de37aefae075d8488d4ba1a7788d574a07"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "termios"
version = "0.2.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "d5d9cf598a6d7ce700a4e6a9199da127e6819a61e64b68609683cc9a01b5683a"
dependencies = [
"libc",
]
[[package]]
name = "thiserror"
version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1e45bcbe8ed29775f228095caf2cd67af7a4ccf756ebff23a306bf3e8b47b24b"
dependencies = [
"thiserror-impl",
]
[[package]]
name = "thiserror-impl"
version = "1.0.57"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a953cb265bef375dae3de6663da4d3804eee9682ea80d8e2542529b73c531c81"
dependencies = [
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "unicode-ident"
version = "1.0.12"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b"
...@@ -5,4 +5,23 @@ edition = "2021" ...@@ -5,4 +5,23 @@ edition = "2021"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[build-dependencies.mavlink-bindgen]
git = "https://github.com/mavlink/rust-mavlink.git"
[dependencies] [dependencies]
mavlink-core = { git = "https://github.com/mavlink/rust-mavlink.git" }
num-traits = { version = "0.2.18", default-features = false }
num-derive = "0.4.2"
bitflags = "2.4.2"
serde = { version = "1.0.197", optional = true }
[features]
default = ["lyra"]
lyra = []
gemini = []
pyxis = []
lynx = []
hermes = []
r2a = []
test = []
serde = ["dep:serde"]
fn main() {} #![recursion_limit = "256"]
use std::env;
use std::path::Path;
pub fn main() {
let src_dir = Path::new(env!("CARGO_MANIFEST_DIR"));
let definitions_dir = src_dir.join("message_definitions");
let out_dir = src_dir.join("src/bindings");
let result = mavlink_bindgen::generate(definitions_dir, out_dir)
.expect("Failed to generate Rust MAVLink bindings");
mavlink_bindgen::format_generated_code(&result);
mavlink_bindgen::emit_cargo_build_messages(&result);
}
#[allow(non_camel_case_types)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[allow(clippy::field_reassign_with_default)]
#[allow(non_snake_case)]
#[allow(clippy::unnecessary_cast)]
#[allow(clippy::bad_bit_mask)]
#[cfg(feature = "gemini")]
pub mod gemini;
#[allow(non_camel_case_types)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[allow(clippy::field_reassign_with_default)]
#[allow(non_snake_case)]
#[allow(clippy::unnecessary_cast)]
#[allow(clippy::bad_bit_mask)]
#[cfg(feature = "hermes")]
pub mod hermes;
#[allow(non_camel_case_types)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[allow(clippy::field_reassign_with_default)]
#[allow(non_snake_case)]
#[allow(clippy::unnecessary_cast)]
#[allow(clippy::bad_bit_mask)]
#[cfg(feature = "lynx")]
pub mod lynx;
#[allow(non_camel_case_types)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[allow(clippy::field_reassign_with_default)]
#[allow(non_snake_case)]
#[allow(clippy::unnecessary_cast)]
#[allow(clippy::bad_bit_mask)]
#[cfg(feature = "lyra")]
pub mod lyra;
#[allow(non_camel_case_types)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[allow(clippy::field_reassign_with_default)]
#[allow(non_snake_case)]
#[allow(clippy::unnecessary_cast)]
#[allow(clippy::bad_bit_mask)]
#[cfg(feature = "pyxis")]
pub mod pyxis;
#[allow(non_camel_case_types)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[allow(clippy::field_reassign_with_default)]
#[allow(non_snake_case)]
#[allow(clippy::unnecessary_cast)]
#[allow(clippy::bad_bit_mask)]
#[cfg(feature = "r2a")]
pub mod r2a;
#[allow(non_camel_case_types)]
#[allow(clippy::derive_partial_eq_without_eq)]
#[allow(clippy::field_reassign_with_default)]
#[allow(non_snake_case)]
#[allow(clippy::unnecessary_cast)]
#[allow(clippy::bad_bit_mask)]
#[cfg(feature = "test")]
pub mod test;
pub fn add(left: usize, right: usize) -> usize { mod bindings;
left + right
}
#[cfg(test)] // Re-export the generated bindings
mod tests { pub use bindings::*;
use super::*;
#[test]
fn it_works() {
let result = add(2, 2);
assert_eq!(result, 4);
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment