GenerateDerive

Trait GenerateDerive 

Source
pub trait GenerateDerive {
    // Required methods
    fn generate_const(
        &mut self,
        ctx: DeriveContext<'_>,
        item: &TraitItemConst,
    ) -> Result<ImplItemConst>;
    fn generate_fn(
        &mut self,
        ctx: DeriveContext<'_>,
        item: &TraitItemFn,
    ) -> Result<ImplItemFn>;
    fn generate_type(
        &mut self,
        ctx: DeriveContext<'_>,
        item: &TraitItemType,
    ) -> Result<ImplItemType>;

    // Provided methods
    fn extend_generics(
        &mut self,
        _ctx: DeriveContext<'_>,
        _generics_params: &mut Vec<GenericParam>,
        _generics_where: &mut Vec<WherePredicate>,
    ) -> Result<()> { ... }
    fn extend_attrs(
        &mut self,
        _ctx: DeriveContext<'_>,
        _attrs: &mut Vec<Attribute>,
    ) -> Result<()> { ... }
}
Expand description

Generates missing items.

Required Methods§

Source

fn generate_const( &mut self, ctx: DeriveContext<'_>, item: &TraitItemConst, ) -> Result<ImplItemConst>

Implements an associated constant.

Source

fn generate_fn( &mut self, ctx: DeriveContext<'_>, item: &TraitItemFn, ) -> Result<ImplItemFn>

Implements an associated function.

Source

fn generate_type( &mut self, ctx: DeriveContext<'_>, item: &TraitItemType, ) -> Result<ImplItemType>

Implements an associated type.

Provided Methods§

Source

fn extend_generics( &mut self, _ctx: DeriveContext<'_>, _generics_params: &mut Vec<GenericParam>, _generics_where: &mut Vec<WherePredicate>, ) -> Result<()>

Provides additional type bounds for the impl block.

Source

fn extend_attrs( &mut self, _ctx: DeriveContext<'_>, _attrs: &mut Vec<Attribute>, ) -> Result<()>

Provides additional attributes for the impl block.

Implementors§