[pbs-devel] [PATCH proxmox] time: exclude certain `use` statements and `impl` block on wasm32

Shannon Sterz s.sterz at proxmox.com
Tue Jun 18 15:40:27 CEST 2024


otherwise the compiler will complain that they aren't used when
compiling the code for wasm32.

Signed-off-by: Shannon Sterz <s.sterz at proxmox.com>
---
 proxmox-time/src/calendar_event.rs  | 1 +
 proxmox-time/src/daily_duration.rs  | 2 ++
 proxmox-time/src/date_time_value.rs | 1 +
 3 files changed, 4 insertions(+)

diff --git a/proxmox-time/src/calendar_event.rs b/proxmox-time/src/calendar_event.rs
index 76883137..4a96c83e 100644
--- a/proxmox-time/src/calendar_event.rs
+++ b/proxmox-time/src/calendar_event.rs
@@ -1,3 +1,4 @@
+#[cfg(not(target_arch = "wasm32"))]
 use std::convert::TryInto;
 
 use anyhow::Error;
diff --git a/proxmox-time/src/daily_duration.rs b/proxmox-time/src/daily_duration.rs
index 3b3d5fdd..9a8bdfc7 100644
--- a/proxmox-time/src/daily_duration.rs
+++ b/proxmox-time/src/daily_duration.rs
@@ -1,4 +1,6 @@
 use std::cmp::{Ordering, PartialOrd};
+
+#[cfg(not(target_arch = "wasm32"))]
 use std::convert::{TryFrom, TryInto};
 
 use anyhow::Error;
diff --git a/proxmox-time/src/date_time_value.rs b/proxmox-time/src/date_time_value.rs
index 72b4c2ee..4dd79d36 100644
--- a/proxmox-time/src/date_time_value.rs
+++ b/proxmox-time/src/date_time_value.rs
@@ -5,6 +5,7 @@ pub(crate) enum DateTimeValue {
     Repeated(u32, u32, Option<u32>),
 }
 
+#[cfg(not(target_arch = "wasm32"))]
 impl DateTimeValue {
     // Test if the entry contains the value
     pub fn contains(&self, value: u32) -> bool {
-- 
2.39.2





More information about the pbs-devel mailing list