pub trait ImplTrait {
    fn path(&self) -> SimplePath;
    fn struct_items(
        &self,
        item: &ItemStruct,
        args: &ImplArgs
    ) -> Result<(Toks, Toks)>; fn support_ignore(&self) -> bool { ... } fn allow_ignore_with(&self) -> Option<SimplePath> { ... } fn support_using(&self) -> bool { ... } fn struct_impl(&self, item: &ItemStruct, args: &ImplArgs) -> Result<Toks> { ... } }
Expand description

Trait required by extensions

Required Methods

Trait path

This path is matched against trait names in #[autoimpl] parameters.

Generate struct items

On success, this method returns the tuple (trait_path, items). These are used to generate the following implementation:

impl #impl_generics #trait_path for #type_ident #ty_generics #where_clause {
    #items
}

Note: this method is only called by the default implementation of Self::struct_impl.

Provided Methods

True if this target supports ignoring fields

Default implementation: false

If the target does not support ignore but does tolerate ignore in the presence of another target (e.g. autoimpl(Eq, PartialEq ignore self.foo)), return the path of that other target here.

True if this target supports using a field

Default implementation: false

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.

Implementors