bytemuck_derive::traits

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”.

Object Safety§

This trait is not object safe.

Implementors§