Skip to content

Commit

Permalink
Feat: add doc to public functions in mavlink-bindgen's lib.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
pv42 authored and patrickelectric committed Aug 7, 2024
1 parent 69703a7 commit 4705886
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions mavlink-bindgen/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,9 @@ pub struct GeneratedBindings {
pub mod_rs: PathBuf,
}

/// Generate Rust MAVLink dialect binding for dialects present in `definitions_dir` into `destination_dir`.
///
/// If successful returns paths of generated bindings linked to their dialect definitions files.
pub fn generate<P1: AsRef<Path>, P2: AsRef<Path>>(
definitions_dir: P1,
destination_dir: P2,
Expand Down Expand Up @@ -99,6 +102,7 @@ fn _generate(
}
}

/// Formats generated code using `rustfmt`.
pub fn format_generated_code(result: &GeneratedBindings) {
if let Err(error) = Command::new("rustfmt")
.args(
Expand All @@ -114,6 +118,7 @@ pub fn format_generated_code(result: &GeneratedBindings) {
}
}

/// Prints definitions for cargo that describe which files the generated code depends on, indicating when it has to be regenerated.
pub fn emit_cargo_build_messages(result: &GeneratedBindings) {
for binding in &result.bindings {
// Re-run build if definition file changes
Expand Down

0 comments on commit 4705886

Please sign in to comment.