pub struct Field<'a> {
pub name_in_attr: Cow<'a, String>,
pub ident: &'a Ident,
pub ty: &'a Type,
pub default_expression: Option<DefaultExpression<'a>>,
pub with_callable: Cow<'a, Expr>,
pub post_transform: Option<&'a PostfixTransform>,
pub skip: bool,
pub multiple: bool,
pub flatten: bool,
}Expand description
Properties needed to generate code for a field in all the contexts where one may appear.
Fields§
§name_in_attr: Cow<'a, String>The name presented to the user of the library. This will appear in error messages and will be looked when parsing names.
ident: &'a IdentThe name presented to the author of the library. This will appear in the setters or temporary variables which contain the values.
ty: &'a TypeThe type of the field in the input.
default_expression: Option<DefaultExpression<'a>>§with_callable: Cow<'a, Expr>An expression that will be wrapped in a call to core::convert::identity and
then used for converting a provided value into the field value before postfix
transforms are called.
post_transform: Option<&'a PostfixTransform>§skip: bool§multiple: bool§flatten: boolIf set, this field will be given all unclaimed meta items and will not be exposed as a standard named field.
Implementations§
Source§impl<'a> Field<'a>
impl<'a> Field<'a>
Sourcepub fn as_name(&'a self) -> Option<&'a str>
pub fn as_name(&'a self) -> Option<&'a str>
Get the name of the meta item that should be matched against input and should be used in diagnostics.
This will be None if the field is skip or flatten, as neither kind of field is addressable
by name from the input meta.