diff --git a/examples/add_netns.rs b/examples/add_netns.rs index ddac000..976d1b8 100644 --- a/examples/add_netns.rs +++ b/examples/add_netns.rs @@ -1,8 +1,13 @@ // SPDX-License-Identifier: MIT +#[cfg(any(linux, android))] use rtnetlink::NetworkNamespace; use std::env; +#[cfg(not(any(linux, android)))] +fn main() -> () {} + +#[cfg(any(linux, android))] #[tokio::main] async fn main() -> Result<(), String> { env_logger::init(); diff --git a/examples/add_netns_async.rs b/examples/add_netns_async.rs index 3014e90..fdcf86f 100644 --- a/examples/add_netns_async.rs +++ b/examples/add_netns_async.rs @@ -1,8 +1,13 @@ // SPDX-License-Identifier: MIT +#[cfg(any(linux, android))] use rtnetlink::NetworkNamespace; use std::env; +#[cfg(not(any(linux, android)))] +fn main() -> () {} + +#[cfg(any(linux, android))] #[async_std::main] async fn main() -> Result<(), String> { env_logger::init(); diff --git a/examples/add_tc_qdisc_ingress.rs b/examples/add_tc_qdisc_ingress.rs index ebb6a75..08e8d7a 100644 --- a/examples/add_tc_qdisc_ingress.rs +++ b/examples/add_tc_qdisc_ingress.rs @@ -4,6 +4,10 @@ use std::env; use rtnetlink::new_connection; +#[cfg(not(any(linux, android)))] +fn main() -> () {} + +#[cfg(any(linux, android))] #[tokio::main] async fn main() -> Result<(), ()> { env_logger::init(); diff --git a/examples/del_netns.rs b/examples/del_netns.rs index 55a13df..5b20f59 100644 --- a/examples/del_netns.rs +++ b/examples/del_netns.rs @@ -1,8 +1,13 @@ // SPDX-License-Identifier: MIT +#[cfg(any(linux, android))] use rtnetlink::NetworkNamespace; use std::env; +#[cfg(not(any(linux, android)))] +fn main() -> () {} + +#[cfg(any(linux, android))] #[tokio::main] async fn main() -> Result<(), String> { let args: Vec = env::args().collect(); diff --git a/examples/del_netns_async.rs b/examples/del_netns_async.rs index 6f105b4..e6b2c38 100644 --- a/examples/del_netns_async.rs +++ b/examples/del_netns_async.rs @@ -1,8 +1,13 @@ // SPDX-License-Identifier: MIT +#[cfg(any(linux, android))] use rtnetlink::NetworkNamespace; use std::env; +#[cfg(not(any(linux, android)))] +fn main() -> () {} + +#[cfg(any(linux, android))] #[async_std::main] async fn main() -> Result<(), String> { let args: Vec = env::args().collect(); diff --git a/examples/get_links.rs b/examples/get_links.rs index 9a33a9c..4b4325a 100644 --- a/examples/get_links.rs +++ b/examples/get_links.rs @@ -7,6 +7,10 @@ use netlink_packet_route::{ }; use rtnetlink::{new_connection, Error, Handle}; +#[cfg(not(any(linux, android)))] +fn main() -> () {} + +#[cfg(any(linux, android))] #[tokio::main] async fn main() -> Result<(), ()> { env_logger::init(); @@ -90,6 +94,7 @@ async fn dump_links(handle: Handle) -> Result<(), Error> { Ok(()) } +#[cfg(any(linux, android))] async fn dump_bridge_filter_info(handle: Handle) -> Result<(), Error> { let mut links = handle .link() diff --git a/examples/get_links_async.rs b/examples/get_links_async.rs index 33b951a..a40db6d 100644 --- a/examples/get_links_async.rs +++ b/examples/get_links_async.rs @@ -7,6 +7,10 @@ use netlink_packet_route::{ }; use rtnetlink::{new_connection, Error, Handle}; +#[cfg(not(any(linux, android)))] +fn main() -> () {} + +#[cfg(any(linux, android))] #[async_std::main] async fn main() -> Result<(), ()> { env_logger::init(); @@ -90,6 +94,7 @@ async fn dump_links(handle: Handle) -> Result<(), Error> { Ok(()) } +#[cfg(any(linux, android))] async fn dump_bridge_filter_info(handle: Handle) -> Result<(), Error> { let mut links = handle .link() diff --git a/examples/get_links_thread_builder.rs b/examples/get_links_thread_builder.rs index 41669b1..0e9ef62 100644 --- a/examples/get_links_thread_builder.rs +++ b/examples/get_links_thread_builder.rs @@ -5,8 +5,11 @@ use netlink_packet_route::{ link::{LinkAttribute, LinkExtentMask}, AddressFamily, }; -use rtnetlink::{new_connection, Error, Handle}; +#[cfg(any(linux, android))] +use rtnetlink::new_connection; +use rtnetlink::{Error, Handle}; +#[cfg(any(linux, android))] async fn do_it(rt: &tokio::runtime::Runtime) -> Result<(), ()> { env_logger::init(); let (connection, handle, _) = new_connection().unwrap(); @@ -89,6 +92,7 @@ async fn dump_links(handle: Handle) -> Result<(), Error> { Ok(()) } +#[cfg(any(linux, android))] async fn dump_bridge_filter_info(handle: Handle) -> Result<(), Error> { let mut links = handle .link() @@ -109,6 +113,10 @@ async fn dump_bridge_filter_info(handle: Handle) -> Result<(), Error> { Ok(()) } +#[cfg(not(any(linux, android)))] +fn main() -> () {} + +#[cfg(any(linux, android))] fn main() -> Result<(), String> { let rt = tokio::runtime::Builder::new_multi_thread() .enable_io()