pub fn if_empty<V, C, Parser, Input>(
parse: Parser,
) -> impl FnOnce(&mut C, Input) -> Result<()>
Expand description
Returns a function checking whether the provided Container::is_empty
and
if so, setting the value parse
d from the provided Input
into it.
§Errors
Propagates the error returned by parse
function, if any.
§Example
Intended to be used as a predicate in a #[parse]
attribute.
#[derive(Default, ParseAttrs)]
struct MyAttributes {
#[parse(value, fallback = field::if_empty(parse::attr::doc))]
description: Option<syn::LitStr>,
}