Releases: ImaMapleTree/derive-ctor
Releases · ImaMapleTree/derive-ctor
v1.0.6
Changes
- Adds
shorthandfeature 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
Changes
Added two new properties for custom constructors
- into - applies the
intoproperty to all non-annotated fields - default - applies the
defaultproperty 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
Fixes
- Fixed an issue where self referencing expressions would cause issues with
default(all)
v1.0.3
Bug Fixes
- Fixed issue where field configurations that would add a required parameter would conflict with
default(all)ctor
v1.0.2
Changes
- Enum variants can now be marked as default (
#[ctor(default)]) and will now implement theDefaulttrait constructing the annotated variant. (similar to structs)- Also works with
default(all)
- Also works with
v1.0.1
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
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
Breaking Changes
- Default Trait Configuration Renaming:
- Renamed the
Defaulttrait configuration inctorfromDefaulttodefault.
- Renamed the
New Features
-
Default Trait Variation:
- Added
default(all)as a variation to struct-ctor configuration, which marks all fields without attributes as#[ctor(default)].
- Added
-
Feature Splitting:
- Split struct and enum support into two separate default features:
structsandenums.
- Split struct and enum support into two separate default features:
Improvements
- Code Formatting:
- Formatted code with
rustfmtfor consistent styling and readability.
- Formatted code with
v0.2.2
Dependency Removal
- Standard Library Dependencies:
- Removed all standard library dependencies, ensuring that the library is always
no-stdcompliant.
- Removed all standard library dependencies, ensuring that the library is always
v0.2.1
New Features
- Default Trait Auto-Implementation:
- Added
#[ctor(Default)]as a configuration for structs, allowing for the auto-implementation of theDefaulttrait.
- Added
Bug Fixes
- no-std Feature:
- Fixed the
no-stdfeature to ensure compatibility and proper functionality.
- Fixed the
Documentation Updates
- README:
- Cleaned up the README for better clarity and updated information.