use Send+Sync on dyn ObjectSchemaType

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2021-02-25 09:16:38 +01:00
parent 42eb380917
commit 8ce46932d6

View File

@ -34,7 +34,7 @@ use crate::try_block;
/// Associates a section type name with a `Schema`. /// Associates a section type name with a `Schema`.
pub struct SectionConfigPlugin { pub struct SectionConfigPlugin {
type_name: String, type_name: String,
properties: &'static (dyn ObjectSchemaType + 'static), properties: &'static (dyn ObjectSchemaType + Send + Sync + 'static),
id_property: Option<String>, id_property: Option<String>,
} }
@ -42,7 +42,7 @@ impl SectionConfigPlugin {
pub fn new( pub fn new(
type_name: String, type_name: String,
id_property: Option<String>, id_property: Option<String>,
properties: &'static (dyn ObjectSchemaType + 'static), properties: &'static (dyn ObjectSchemaType + Send + Sync + 'static),
) -> Self { ) -> Self {
Self { Self {
type_name, type_name,
@ -59,7 +59,7 @@ impl SectionConfigPlugin {
self.id_property.as_deref() self.id_property.as_deref()
} }
pub fn properties(&self) -> &(dyn ObjectSchemaType + 'static) { pub fn properties(&self) -> &(dyn ObjectSchemaType + Send + Sync + 'static) {
self.properties self.properties
} }
@ -361,7 +361,7 @@ impl SectionConfig {
let mut state = ParseState::BeforeHeader; let mut state = ParseState::BeforeHeader;
let test_required_properties = |value: &Value, let test_required_properties = |value: &Value,
schema: &dyn ObjectSchemaType, schema: &(dyn ObjectSchemaType + Send + Sync),
id_property: &Option<String>| id_property: &Option<String>|
-> Result<(), Error> { -> Result<(), Error> {
for (name, optional, _prop_schema) in schema.properties() { for (name, optional, _prop_schema) in schema.properties() {