From 00ca04698d16f480b037a4987d36c849c30639a1 Mon Sep 17 00:00:00 2001 From: Wolfgang Bumiller Date: Wed, 28 Aug 2024 14:35:27 +0200 Subject: [PATCH] schema: seal ObjectSchemaType and assert Send + Sync While this is technically a breaking API change since the trait is public, we don't implement it anywhere and it isn't meant to be implemented from the outside. Also, encode that these types are all Send + Sync via a super trait notation. Signed-off-by: Wolfgang Bumiller --- proxmox-schema/src/schema.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/proxmox-schema/src/schema.rs b/proxmox-schema/src/schema.rs index 5cda29bd..0e551ef7 100644 --- a/proxmox-schema/src/schema.rs +++ b/proxmox-schema/src/schema.rs @@ -806,8 +806,16 @@ impl OneOfSchema { } } +mod private { + pub trait Sealed: Send + Sync {} + impl Sealed for super::ObjectSchema {} + impl Sealed for super::AllOfSchema {} + impl Sealed for super::OneOfSchema {} + impl Sealed for super::ParameterSchema {} +} + /// Beside [`ObjectSchema`] we also have an [`AllOfSchema`] which also represents objects. -pub trait ObjectSchemaType { +pub trait ObjectSchemaType: private::Sealed + Send + Sync { fn description(&self) -> &'static str; fn lookup(&self, key: &str) -> Option<(bool, &Schema)>; fn properties(&self) -> ObjectPropertyIterator;