forked from Proxmox/proxmox
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 <w.bumiller@proxmox.com>
This commit is contained in:
parent
e750bce69b
commit
00ca04698d
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user