mavlink-core 0.20.0

Implements the MAVLink data interchange format for UAVs.
Documentation
macro_rules! dispatch_transport {
    ($inner:expr, |$transport:ident| $call:expr) => {
        match $inner {
            #[cfg(feature = "transport-tcp")]
            Transport::Tcp($transport) => $call,
            #[cfg(feature = "transport-udp")]
            Transport::Udp($transport) => $call,
            #[cfg(feature = "transport-direct-serial")]
            Transport::Serial($transport) => $call,
            Transport::File($transport) => $call,
        }
    };
}

mod sync;

#[cfg(feature = "transport-tcp")]
pub mod tcp;

#[cfg(feature = "transport-udp")]
pub mod udp;

#[cfg(feature = "transport-direct-serial")]
pub mod direct_serial;

pub mod file;

#[cfg(any(feature = "transport-tcp", feature = "transport-udp"))]
use std::io;
pub use sync::{
    Connectable, Connection, DialectConnection, MavConnection, connect, connect_with_dialect,
};

/// Returns the socket address for the given address.
#[cfg(any(feature = "transport-tcp", feature = "transport-udp"))]
pub(crate) fn get_socket_addr<T: std::net::ToSocketAddrs>(
    address: &T,
) -> Result<std::net::SocketAddr, io::Error> {
    address
        .to_socket_addrs()?
        .next()
        .ok_or(io::Error::other("Host address lookup failed"))
}

#[cfg(feature = "tokio")]
mod r#async;
#[cfg(feature = "tokio")]
pub use r#async::{
    AsyncConnectable, AsyncConnection, AsyncDialectConnection, AsyncMavConnection, connect_async,
    connect_async_with_dialect,
};