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§
Sourcefn generate_const(
&mut self,
ctx: DeriveContext<'_>,
item: &TraitItemConst,
) -> Result<ImplItemConst>
fn generate_const( &mut self, ctx: DeriveContext<'_>, item: &TraitItemConst, ) -> Result<ImplItemConst>
Implements an associated constant.
Sourcefn generate_fn(
&mut self,
ctx: DeriveContext<'_>,
item: &TraitItemFn,
) -> Result<ImplItemFn>
fn generate_fn( &mut self, ctx: DeriveContext<'_>, item: &TraitItemFn, ) -> Result<ImplItemFn>
Implements an associated function.
Sourcefn generate_type(
&mut self,
ctx: DeriveContext<'_>,
item: &TraitItemType,
) -> Result<ImplItemType>
fn generate_type( &mut self, ctx: DeriveContext<'_>, item: &TraitItemType, ) -> Result<ImplItemType>
Implements an associated type.
Provided Methods§
Sourcefn extend_generics(
&mut self,
_ctx: DeriveContext<'_>,
_generics_params: &mut Vec<GenericParam>,
_generics_where: &mut Vec<WherePredicate>,
) -> Result<()>
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.
Sourcefn extend_attrs(
&mut self,
_ctx: DeriveContext<'_>,
_attrs: &mut Vec<Attribute>,
) -> Result<()>
fn extend_attrs( &mut self, _ctx: DeriveContext<'_>, _attrs: &mut Vec<Attribute>, ) -> Result<()>
Provides additional attributes for the impl block.