derive_utils

A procedural macro helper for easily writing custom derives for enums.

APACHE-2.0 License

Downloads
5.7M
Stars
31
Committers
2

Bot releases are visible (Hide)

derive_utils - 0.14.2 Latest Release

Published by github-actions[bot] about 2 months ago

  • Disable derive feature of syn dependency.
derive_utils - 0.14.1

Published by github-actions[bot] 9 months ago

  • Fix "overflow evaluating the requirement" error when the first variant and the other variant have the same type.

  • Fix a bug introduced in 0.14.0.

derive_utils - 0.14.0

Published by github-actions[bot] 9 months ago

  • Allow quote variables in the trait definition of quick_derive! macro.

    This is considered as a breaking change because it will no longer allow a comma after the trait definition.

  • Change the second argument of derive_trait and EnumImpl::from_trait from syn::Path to &syn::Path.

  • Fix "overflow evaluating the requirement" error on recursive structures without type parameters. (#47)

derive_utils - 0.13.2

Published by github-actions[bot] about 1 year ago

  • Fix diagnostic regression introduced in 0.13.0.
derive_utils - 0.13.1

Published by github-actions[bot] over 1 year ago

  • Fix build error from dependency when built with -Z minimal-versions.
derive_utils - 0.13.0

Published by github-actions[bot] over 1 year ago

  • Update syn dependency to 2. This increase the minimum supported Rust version from Rust 1.31 to Rust 1.56.
derive_utils - 0.12.0

Published by github-actions[bot] almost 3 years ago

  • Remove support for self: Pin<&(mut) Self>. See #41 for more.
derive_utils - 0.11.2

Published by github-actions[bot] almost 4 years ago

  • Exclude unneeded files from crates.io.
derive_utils - 0.11.1

Published by github-actions[bot] almost 4 years ago

  • Documentation improvements.
derive_utils - 0.11.0

Published by taiki-e almost 4 years ago

  • quick_derive!, derive_trait, EnumImpl::from_trait, EnumImpl::push_method, and EnumImpl::append_items_from_trait are now panic if an unsupported trait definition passed, instead of return error. See #35 for details.
derive_utils - 0.10.0

Published by taiki-e over 4 years ago

  • quick_derive! macro now accepts both proc_macro2::TokenStream and proc_macro::TokenStream as input.

  • quick_derive! macro no longer supports trait path elision.

  • The parentheses that wrap the trait path passed to quick_derive! macro are no longer needed. For example:

      quick_derive! {
          input,
          // trait path
    -     (std::iter::Iterator),
    +     std::iter::Iterator,
          // trait definition
          trait Iterator {
              type Item;
              fn next(&mut self) -> Option<Self::Item>;
              fn size_hint(&self) -> (usize, Option<usize>);
          }
      }
    
  • The way of specifying super trait's associated types has been changed.

      quick_derive! {
          input,
    -     // super trait's associated types
    -     Item,
    -     // trait path
    -     (std::iter::ExactSizeIterator),
    +     // trait path
    +     std::iter::ExactSizeIterator,
    +     // super trait's associated types
    +     <Item>,
          // trait definition
          trait ExactSizeIterator: Iterator {
              fn len(&self) -> usize;
          }
      }
    
  • Added derive_trait function.

  • Added EnumImpl::{new, from_trait} functions.

  • Added EnumData::{field_types, variant_idents} methods.

  • Removed derive_trait! macro in favor of derive_trait function.

  • Removed EnumData::make_impl and EnumData::impl_with_capacity in favor of EnumImpl::new.

  • Removed EnumData::make_impl_trait and EnumData::impl_trait_with_capacity in favor of EnumImpl::from_trait.

  • Removed EnumImpl::push_generic_param_ident in favor of EnumImpl::push_generic_param(TypeParam::from(ident).into()).

  • Removed MaybeEnum and EnumElements in favor of syn::parse::<EnumData>().

  • Removed some hidden APIs.

  • Implemented Deref<Target = syn::ItemEnum>, syn::parse::Parse, and quote::ToTokens for EnumData

  • Implemented From<EnumData> for syn::ItemEnum

derive_utils - 0.9.1

Published by taiki-e about 5 years ago

derive_utils - 0.9.0

Published by taiki-e about 5 years ago

  • Updated proc-macro2, syn, and quote to 1.0.

  • Banned manual implementation of MaybeEnum for forward compatibility.

  • Addef vis: Visibility field to EnumElements.

  • Hided some undocumented items from the public API.

derive_utils - 0.8.0

Published by taiki-e about 5 years ago

  • Added quote::ToTokens bound to MaybeEnum.

  • Removed EnumData::{from_item, from_derive} in favor of EnumData::new

  • Improved error messages.

derive_utils - 0.7.2

Published by taiki-e over 5 years ago

  • Improved error messages.
derive_utils - 0.7.1

Published by taiki-e over 5 years ago

  • Improved support for arbitrary self type.

  • Improved the error messages.

derive_utils - 0.7.0

Published by taiki-e over 5 years ago

  • Transition to Rust 2018. With this change, the minimum required version will go up to Rust 1.31.

  • Improved the error messages.

  • Removed Error and Result types. The current derive_utils uses syn::Error and syn::Result types.

Package Rankings
Top 10.05% on Crates.io
Badges
Extracted from project README
crates.io docs.rs license msrv github actions