Skip to content

Possible future improvements #25

Open
@daxpedda

Description

@daxpedda

These are code improvements or features that could be added in the future if demand is there:

  • Revive Implement Ord for mem::Discriminant rust-lang/rust#51561, which would get rid of the nightly crate feature and remove parts of the safe crate feature implementation.
  • Improve safe PartialOrd and Ord codegen, done in Improve code generation of Ord and PartialOrd #38.
  • Implement #[derive_where(Clone; T = u8)], which will generate impl Clone for Test<u8>.
  • Crate feature to disable warnings, currently errors that don't prevent derive-where from functioning correctly but point to invalid use-cases (use std derive) instead or bad code quality (empty bracers). Currently Rust doesn't have a compile_warn.
  • Remove quote and build any Rust code purely with syn structures instead.
  • Improve generated code, mainly remove match and access fields directly when not dealing with an enum. This is mainly modeled after std's derive, which was probably done to make it easy to implement as it makes code generation between enums and structs very similar, but after many refactors, there is no real advantage anymore.
  • Use once-cell or something similar to cache patterns and Idents, some implementation don't need them, but we don't want to generate them ad-hoc as they do some allocations. The main concern here is adding another dependency.
  • Use arrayvec or something similar to store traits, reducing overall allocations. We know what the maximum amount of possible traits are, no need to do any allocations. To reduce dependencies we could make our own.
  • Use smallvec or something similar to store fields and such, we don't expect structs to have an unlimited amount of fields. Again, another dependency.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions