Skip to content

Commit 4beacd6

Browse files
DusterTheFirstpatrickelectric
authored andcommitted
fix: tcp, udp, and serial features were not fully configured for conditional compilation
1 parent f0d19f7 commit 4beacd6

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

mavlink-core/src/async_connection/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -97,6 +97,7 @@ pub async fn connect_async<M: Message + Sync + Send>(
9797
}
9898

9999
/// Returns the socket address for the given address.
100+
#[cfg(any(feature = "tcp", feature = "udp"))]
100101
pub(crate) fn get_socket_addr<T: std::net::ToSocketAddrs>(
101102
address: T,
102103
) -> Result<std::net::SocketAddr, io::Error> {
@@ -126,8 +127,11 @@ impl AsyncConnectable for ConnectionAddress {
126127
M: Message + Sync + Send,
127128
{
128129
match self {
130+
#[cfg(feature = "tcp")]
129131
Self::Tcp(connectable) => connectable.connect_async::<M>().await,
132+
#[cfg(feature = "udp")]
130133
Self::Udp(connectable) => connectable.connect_async::<M>().await,
134+
#[cfg(feature = "direct-serial")]
131135
Self::Serial(connectable) => connectable.connect_async::<M>().await,
132136
Self::File(connectable) => connectable.connect_async::<M>().await,
133137
}

mavlink-core/src/connectable.rs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,17 +87,23 @@ impl Display for FileConnectable {
8787
}
8888
}
8989
pub enum ConnectionAddress {
90+
#[cfg(feature = "tcp")]
9091
Tcp(TcpConnectable),
92+
#[cfg(feature = "udp")]
9193
Udp(UdpConnectable),
94+
#[cfg(feature = "direct-serial")]
9295
Serial(SerialConnectable),
9396
File(FileConnectable),
9497
}
9598

9699
impl Display for ConnectionAddress {
97100
fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
98101
match self {
102+
#[cfg(feature = "tcp")]
99103
Self::Tcp(connectable) => write!(f, "{connectable}"),
104+
#[cfg(feature = "udp")]
100105
Self::Udp(connectable) => write!(f, "{connectable}"),
106+
#[cfg(feature = "direct-serial")]
101107
Self::Serial(connectable) => write!(f, "{connectable}"),
102108
Self::File(connectable) => write!(f, "{connectable}"),
103109
}

mavlink-core/src/connection/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ pub fn connect<M: Message + Sync + Send>(
8787
}
8888

8989
/// Returns the socket address for the given address.
90+
#[cfg(any(feature = "tcp", feature = "udp"))]
9091
pub(crate) fn get_socket_addr<T: std::net::ToSocketAddrs>(
9192
address: &T,
9293
) -> Result<std::net::SocketAddr, io::Error> {
@@ -106,8 +107,11 @@ impl Connectable for ConnectionAddress {
106107
M: Message,
107108
{
108109
match self {
110+
#[cfg(feature = "tcp")]
109111
Self::Tcp(connectable) => connectable.connect::<M>(),
112+
#[cfg(feature = "udp")]
110113
Self::Udp(connectable) => connectable.connect::<M>(),
114+
#[cfg(feature = "direct-serial")]
111115
Self::Serial(connectable) => connectable.connect::<M>(),
112116
Self::File(connectable) => connectable.connect::<M>(),
113117
}

0 commit comments

Comments
 (0)