macro: recurse into struct field verifiers

Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
Wolfgang Bumiller 2019-07-31 14:35:00 +02:00
parent 3c31381fb2
commit 14acfcd5cd

View File

@ -605,6 +605,13 @@ fn named_struct_impl_verify(span: Span, fields: &[StructField]) -> Result<TokenS
let field_ident = field.ident;
let field_str = &field.strlit;
// first of all, recurse into the contained types:
body.extend(quote_spanned! { field_ident.span() =>
::proxmox::api::ApiType::verify(&self.#field_ident)?;
});
// then go through all the additional verifiers:
if let Some(ref value) = field.def.minimum {
body.extend(quote_spanned! { value.span() =>
let value = #value;