Skip to content

Releases: ImaMapleTree/derive-ctor

v1.0.6

11 Jun 16:27
1d86aa2

Choose a tag to compare

Changes

  • Adds shorthand feature which when enabled allows for the usage of "shorthand" field properties

Example

use derive_ctor::ctor;

#[derive(ctor)]
struct MyStruct {
    #[expr(100)]  // if using "shorthand" feature we can use "#[expr]" instead of "#[ctor(expr)]"
    value: u32
}

let my_struct = MyStruct::new();

v1.0.5

09 Jun 14:58
43b0b7e

Choose a tag to compare

Changes

Added two new properties for custom constructors

  • into - applies the into property to all non-annotated fields
  • default - applies the default property to all non-annotated fields

Here's an example of how to apply these properties:

use derive_ctor::ctor;

#[derive(ctor)]
#[ctor(pub new(into), with_defaults(default)]
struct MyStruct {
    name: String,
    #[ctor(expr(100))]
    gold: i32
}

v1.0.4

08 Jun 11:41
2741887

Choose a tag to compare

Fixes

  • Fixed an issue where self referencing expressions would cause issues with default(all)

v1.0.3

05 Jun 12:13
1214101

Choose a tag to compare

Bug Fixes

  • Fixed issue where field configurations that would add a required parameter would conflict with default(all) ctor

v1.0.2

02 Jun 12:43
6948ed4

Choose a tag to compare

Changes

  • Enum variants can now be marked as default (#[ctor(default)]) and will now implement the Default trait constructing the annotated variant. (similar to structs)
    • Also works with default(all)

v1.0.1

01 Jun 15:25
8591bf4

Choose a tag to compare

Bug Fixes

  • Fixed issue where if enum variant name matched a keyword the generated method would cause the derive to break as it'd generate a method named a keyword

v1.0.0

31 May 03:26
06c1a86

Choose a tag to compare

Release v1.0.0 (First Major Release)

#[derive(ctor)] now works on enums, structs, and unions!

New Features:

  • Added support for unions

BTS Changes:

  • Features now control the modules used by the library, thus disabling a feature should reduce code size

Other:

Release v1.0.0 marks the first release of a major-working version of derive-ctor. I feel satisfied with the state of the library and do not plan on changing any currently implemented features, thus all v1.* versions should be fully compatible with each other.

Feel free to suggest more features to the library, or create PRs which improve the library!

v0.2.3

30 May 15:16
743255c

Choose a tag to compare

Breaking Changes

  • Default Trait Configuration Renaming:
    • Renamed the Default trait configuration in ctor from Default to default.

New Features

  • Default Trait Variation:

    • Added default(all) as a variation to struct-ctor configuration, which marks all fields without attributes as #[ctor(default)].
  • Feature Splitting:

    • Split struct and enum support into two separate default features: structs and enums.

Improvements

  • Code Formatting:
    • Formatted code with rustfmt for consistent styling and readability.

v0.2.2

30 May 11:06
d7ad8ba

Choose a tag to compare

Dependency Removal

  • Standard Library Dependencies:
    • Removed all standard library dependencies, ensuring that the library is always no-std compliant.

v0.2.1

30 May 09:59
df0a0c1

Choose a tag to compare

New Features

  • Default Trait Auto-Implementation:
    • Added #[ctor(Default)] as a configuration for structs, allowing for the auto-implementation of the Default trait.

Bug Fixes

  • no-std Feature:
    • Fixed the no-std feature to ensure compatibility and proper functionality.

Documentation Updates

  • README:
    • Cleaned up the README for better clarity and updated information.