diff --git a/proxmox-api-macro/src/api_macro.rs b/proxmox-api-macro/src/api_macro.rs index 190e78f0..f47bc994 100644 --- a/proxmox-api-macro/src/api_macro.rs +++ b/proxmox-api-macro/src/api_macro.rs @@ -592,7 +592,7 @@ fn named_struct_impl_verify( if let Some(ref minimum) = field.def.minimum { body.extend(quote_spanned! { minimum.span() => let minimum = #minimum; - if !::proxmox::api::verify::Verify::test_minimum(&self.#field_ident, &minimum) { + if !::proxmox::api::verify::TestMinMax::test_minimum(&self.#field_ident, &minimum) { error_string.push_str( &format!("field {} out of range, must be >= {}", #field_str, minimum) ); @@ -603,7 +603,7 @@ fn named_struct_impl_verify( if let Some(ref maximum) = field.def.maximum { body.extend(quote_spanned! { maximum.span() => let maximum = #maximum; - if !::proxmox::api::verify::Verify::test_maximum(&self.#field_ident, &maximum) { + if !::proxmox::api::verify::TestMinMax::test_maximum(&self.#field_ident, &maximum) { error_string.push_str( &format!("field {} out of range, must be <= {}", #field_str, maximum) ); diff --git a/proxmox-api/src/verify.rs b/proxmox-api/src/verify.rs index 83f3b0f1..defa5d8e 100644 --- a/proxmox-api/src/verify.rs +++ b/proxmox-api/src/verify.rs @@ -40,12 +40,12 @@ pub mod mark { pub struct Special; } -pub trait Verify { +pub trait TestMinMax { fn test_minimum(&self, minimum: &Other) -> bool; fn test_maximum(&self, maximum: &Other) -> bool; } -impl Verify for Other +impl TestMinMax for Other where Other: Ord, { @@ -60,7 +60,7 @@ where } } -impl Verify for Option +impl TestMinMax for Option where Other: Ord, { @@ -74,7 +74,3 @@ where self.as_ref().map(|x| *x <= *maximum).unwrap_or(true) } } - -pub fn test_minimum>(value: &T, minimum: &U) -> bool { - value.test_minimum(minimum) -}