Trait impl_tools_lib::autoimpl::ImplTrait
source · [−]pub trait ImplTrait {
fn path(&self) -> SimplePath;
fn support_ignore(&self) -> bool;
fn support_using(&self) -> bool;
fn struct_items(
&self,
item: &ItemStruct,
args: &ImplArgs
) -> Result<TokenStream>;
fn struct_impl(
&self,
item: &ItemStruct,
args: &ImplArgs
) -> Result<TokenStream> { ... }
}
Expand description
Trait required by extensions
Required Methods
fn path(&self) -> SimplePath
fn path(&self) -> SimplePath
Trait path
The full path is printed in implementations. Only the last component is normally used when matching.
fn support_ignore(&self) -> bool
fn support_ignore(&self) -> bool
True if this target supports ignoring fields
fn support_using(&self) -> bool
fn support_using(&self) -> bool
True if this target supports using a field
fn struct_items(&self, item: &ItemStruct, args: &ImplArgs) -> Result<TokenStream>
fn struct_items(&self, item: &ItemStruct, args: &ImplArgs) -> Result<TokenStream>
Generate struct items
The resulting items are injected into an impl of the form
impl<..> TraitName for StructName<..> where .. { #items }
.
Provided Methods
fn struct_impl(&self, item: &ItemStruct, args: &ImplArgs) -> Result<TokenStream>
fn struct_impl(&self, item: &ItemStruct, args: &ImplArgs) -> Result<TokenStream>
Generate an impl for a struct item
The default implementation is a wrapper around Self::struct_items
and suffices for most cases. It may be overridden, e.g. to generate
multiple implementation items. It is not recommended to modify the
generics.