From 76146b0e8c4a4936bdcf79d02be902d2752033dc Mon Sep 17 00:00:00 2001 From: bitfl0wer Date: Sat, 20 Jul 2024 17:54:49 +0200 Subject: [PATCH] Fix: Compile error with no default features --- src/types/entities/mod.rs | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/src/types/entities/mod.rs b/src/types/entities/mod.rs index b413e8e..2fec4ca 100644 --- a/src/types/entities/mod.rs +++ b/src/types/entities/mod.rs @@ -142,13 +142,21 @@ impl IntoShared for T { } } -/// Internal function to compare two `Arc>`s by comparing their pointers. -pub(crate) fn arc_rwlock_ptr_eq(a: &Arc>, b: &Arc>) -> bool { - Arc::ptr_eq(a, b) +/// Internal function to compare two `Shared`s by comparing their pointers. +#[cfg_attr(not(feature = "client"), allow(unused_variables))] +pub(crate) fn arc_rwlock_ptr_eq(a: &Shared, b: &Shared) -> bool { + #[cfg(feature = "client")] + { + Shared::ptr_eq(a, b) + } + #[cfg(not(feature = "client"))] + { + true + } } -/// Internal function to compare two `Vec>>`s by comparing their pointers. -pub(crate) fn vec_arc_rwlock_ptr_eq(a: &Vec>>, b: &Vec>>) -> bool { +/// Internal function to compare two `Vec>`s by comparing their pointers. +pub(crate) fn vec_arc_rwlock_ptr_eq(a: &[Shared], b: &[Shared]) -> bool { for (a, b) in a.iter().zip(b.iter()) { if !arc_rwlock_ptr_eq(a, b) { return false; @@ -157,11 +165,8 @@ pub(crate) fn vec_arc_rwlock_ptr_eq(a: &Vec>>, b: &Vec>>`s by comparing their pointers. -pub(crate) fn option_arc_rwlock_ptr_eq( - a: &Option>>, - b: &Option>>, -) -> bool { +/// Internal function to compare two `Option>`s by comparing their pointers. +pub(crate) fn option_arc_rwlock_ptr_eq(a: &Option>, b: &Option>) -> bool { match (a, b) { (Some(a), Some(b)) => arc_rwlock_ptr_eq(a, b), (None, None) => true, @@ -169,10 +174,10 @@ pub(crate) fn option_arc_rwlock_ptr_eq( } } -/// Internal function to compare two `Option>>>`s by comparing their pointers. +/// Internal function to compare two `Option>>`s by comparing their pointers. pub(crate) fn option_vec_arc_rwlock_ptr_eq( - a: &Option>>>, - b: &Option>>>, + a: &Option>>, + b: &Option>>, ) -> bool { match (a, b) { (Some(a), Some(b)) => vec_arc_rwlock_ptr_eq(a, b),