pub trait DeriveInputStructExt {
    // Required methods
    fn data_struct(&self) -> &DataStruct;
    fn data_struct_mut(&mut self) -> &mut DataStruct;
    fn fields(&self) -> &Fields;
    fn fields_mut(&mut self) -> &mut Fields;
    fn fields_named(&self) -> &FieldsNamed;
    fn fields_named_mut(&mut self) -> &mut FieldsNamed;
    fn is_unit(&self) -> bool;
    fn is_named(&self) -> bool;
    fn is_tuple(&self) -> bool;
    fn assert_fields_unit(&self);
    fn assert_fields_named(&self);
    fn assert_fields_unnamed(&self);
}
Expand description

Functions to make it ergonomic to work with struct ASTs.

Required Methods§

source

fn data_struct(&self) -> &DataStruct

Returns a reference to the data_struct of a struct’s AST.

Panics

Panics if the AST is not for a struct.

source

fn data_struct_mut(&mut self) -> &mut DataStruct

Returns a mutable reference to the data_struct of a struct’s AST.

Panics

Panics if the AST is not for a struct.

source

fn fields(&self) -> &Fields

Returns a reference to the fields of a struct’s AST.

Panics

Panics if the AST is not for a struct.

source

fn fields_mut(&mut self) -> &mut Fields

Returns a mutable reference to the fields of a struct’s AST.

Panics

Panics if the AST is not for a struct.

source

fn fields_named(&self) -> &FieldsNamed

Returns a mutable reference to the named fields of a struct’s AST.

Panics

Panics if the AST is not for a struct with named fields.

source

fn fields_named_mut(&mut self) -> &mut FieldsNamed

Returns a mutable reference to the named fields of a struct’s AST.

Panics

Panics if the AST is not for a struct with named fields.

source

fn is_unit(&self) -> bool

Returns true if the AST is for a unit struct.

source

fn is_named(&self) -> bool

Returns true if the AST is for a struct with named fields.

source

fn is_tuple(&self) -> bool

Returns true if the AST is for a struct with unnamed fields.

source

fn assert_fields_unit(&self)

Panics if the AST is not for a unit struct.

source

fn assert_fields_named(&self)

Panics if the AST is not for a struct with named fields.

source

fn assert_fields_unnamed(&self)

Panics if the AST is not for a struct with unnamed fields.

Implementations on Foreign Types§

source§

impl DeriveInputStructExt for DeriveInput

Implementors§