Derivable

Trait Derivable 

Source
pub trait Derivable {
    // Required method
    fn ident(input: &DeriveInput, crate_name: &TokenStream) -> Result<Path>;

    // Provided methods
    fn implies_trait(_crate_name: &TokenStream) -> Option<TokenStream> { ... }
    fn asserts(
        _input: &DeriveInput,
        _crate_name: &TokenStream,
    ) -> Result<TokenStream> { ... }
    fn check_attributes(_ty: &Data, _attributes: &[Attribute]) -> Result<()> { ... }
    fn trait_impl(
        _input: &DeriveInput,
        _crate_name: &TokenStream,
    ) -> Result<(TokenStream, TokenStream)> { ... }
    fn requires_where_clause() -> bool { ... }
    fn explicit_bounds_attribute_name() -> Option<&'static str> { ... }
    fn perfect_derive_fields(_input: &DeriveInput) -> Option<Fields> { ... }
}

Required Methods§

Source

fn ident(input: &DeriveInput, crate_name: &TokenStream) -> Result<Path>

Provided Methods§

Source

fn implies_trait(_crate_name: &TokenStream) -> Option<TokenStream>

Source

fn asserts( _input: &DeriveInput, _crate_name: &TokenStream, ) -> Result<TokenStream>

Source

fn check_attributes(_ty: &Data, _attributes: &[Attribute]) -> Result<()>

Source

fn trait_impl( _input: &DeriveInput, _crate_name: &TokenStream, ) -> Result<(TokenStream, TokenStream)>

Source

fn requires_where_clause() -> bool

Source

fn explicit_bounds_attribute_name() -> Option<&'static str>

Source

fn perfect_derive_fields(_input: &DeriveInput) -> Option<Fields>

If this trait has a custom meaning for “perfect derive”, this function should be overridden to return Some.

The default is “the fields of a struct; unions and enums not supported”.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§