pub struct Core {
pub ident: Ident,
pub generics: Generics,
pub default: Option<DefaultExpression>,
pub rename_rule: RenameRule,
pub post_transform: Option<PostfixTransform>,
pub data: Data<InputVariant, InputField>,
pub bound: Option<Vec<WherePredicate>>,
pub allow_unknown_fields: Option<bool>,
}
Expand description
A struct or enum which should have FromMeta
or FromDeriveInput
implementations
generated.
Fields§
§ident: Ident
The type identifier.
generics: Generics
The type’s generics. If the type does not use any generics, this will be an empty instance.
default: Option<DefaultExpression>
Controls whether missing properties should cause errors or should be filled by the result of a function call. This can be overridden at the field level.
rename_rule: RenameRule
The rule that should be used to rename all fields/variants in the container.
post_transform: Option<PostfixTransform>
A transform which will be called on darling::Result<Self>
. It must either be
an FnOnce(T) -> T
when map
is used, or FnOnce(T) -> darling::Result<T>
when
and_then
is used.
map
and and_then
are mutually-exclusive to avoid confusion about the order in
which the two are applied.
data: Data<InputVariant, InputField>
The body of the deriving type.
bound: Option<Vec<WherePredicate>>
The custom bound to apply to the generated impl
allow_unknown_fields: Option<bool>
Whether or not unknown fields should produce an error at compilation time.
Implementations§
source§impl Core
impl Core
sourcepub fn start(di: &DeriveInput) -> Result<Self>
pub fn start(di: &DeriveInput) -> Result<Self>
Partially initializes Core
by reading the identity, generics, and body shape.
fn as_codegen_default(&self) -> Option<DefaultExpression<'_>>
Trait Implementations§
source§impl ParseAttribute for Core
impl ParseAttribute for Core
source§impl ParseData for Core
impl ParseData for Core
source§fn parse_variant(&mut self, variant: &Variant) -> Result<()>
fn parse_variant(&mut self, variant: &Variant) -> Result<()>
source§fn parse_field(&mut self, field: &Field) -> Result<()>
fn parse_field(&mut self, field: &Field) -> Result<()>
source§fn validate_body(&self, errors: &mut Accumulator)
fn validate_body(&self, errors: &mut Accumulator)
fn parse_body(self, body: &Data) -> Result<Self>
Auto Trait Implementations§
impl Freeze for Core
impl RefUnwindSafe for Core
impl !Send for Core
impl !Sync for Core
impl Unpin for Core
impl UnwindSafe for Core
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)