# CHANGELOG
## v0.5.1 (unreleased)
- Fix: struct level `#[cfg(...)]` attribute was not applied to the generated impl blocks.
- Fix: `gen` is a reserved keyword since Rust 2024 edition.
```rust
wrapper_lite::wrapper!(
#[gen(...)]
pub struct Foobar<T>(T);
);
```
Instead:
```rust
wrapper_lite::wrapper!(
#[wrapper(...)]
pub struct Foobar<T>(T);
);
```
## v0.5.0
Due to the thorough refactoring we performed in this version, the changes listed here may not be complete.
- `#[wrapper_impl(...)]` is now deprecated in favor of `#[wrapper(...)]`.
```rust
wrapper_lite::wrapper!(
#[wrapper_impl(...)]
pub struct Foobar<T>(T);
);
```
Instead:
```rust
wrapper_lite::wrapper!(
#[wrapper(...)]
pub struct Foobar<T>(T);
);
```
- `#[wrapper(ConstAsMut)]` (`#[wrapper_impl(ConstAsMut)]`) is now removed.
```rust
wrapper_lite::wrapper!(
#[wrapper_impl(ConstAsMut)]
pub struct Foobar<T>(T);
);
```
Instead, use `#[wrapper([const] AsMut)]`:
```rust
wrapper_lite::wrapper!(
#[wrapper([const] AsMut)]
pub struct Foobar<T>(T);
);
```
- `general_wrapper!` is essentially `wrapper!` with `#[wrapper(AsRef)]`, `#[wrapper(Borrow)]`, and `#[wrapper(From)]`. To avoid unnecessary confusion (requiring users to check the documentation to know which traits are implemented), it's now deprecated.
```rust
wrapper_lite::general_wrapper!(
pub struct Foobar<T>(T);
);
```
Instead:
```rust
wrapper_lite::wrapper!(
#[wrapper(AsRef)]
#[wrapper(Borrow)]
#[wrapper(From)]
pub struct Foobar<T>(T);
);
```
- Syntax for specifying the default values for the other fields is now changed.
```rust
wrapper_lite::wrapper!(
#[wrapper_impl(From)]
pub struct Foobar<T> {
inner: T,
_marker: ::core::marker::PhantomData<()> = ::core::marker::PhantomData,
}
);
```
Instead:
```rust
wrapper_lite::wrapper!(
#[wrapper(From)]
pub struct TestWrapperComplex<T> {
inner: T,
#[default(::core::marker::PhantomData)]
_marker: ::core::marker::PhantomData<()>,
}
);
```
This makes `rustfmt` happy and improves readability.
- A new attribute `#[bound(...)]` is added, which fixes some edge cases. Please check the docs for details.
## v0.4.0
- The generated method `const_from` is renamed to `from_inner` for better readability.
- Fix HRTB and default generic type handling, see the docs for details.
- No longer add `#[repr(transparent)]` attribute by default.
## v0.3.2
None
## v0.3.1
- For brace struct, the inner field name is no longer required to be `inner`. The first field will be treated as the inner field.
```rust
wrapper_lite::wrapper!(
#[wrapper_impl(AsRef<str>)]
pub struct TestWrapperComplex {
value: String, _marker: ::core::marker::PhantomData<()>,
}
);
```
- The `#[repr(align(cache))]` attribute is introduced, please check the docs for details.
```rust
wrapper_lite::wrapper!(
#[repr(align(cache))]
pub struct AlignedWrapper(u8);
);
```
## v0.3.0
- When there's no default value specified, we cannot implement the `From` trait for the wrapper type, and it's now a hard error.
```rust,compile_fail
wrapper_lite::wrapper!(
#[wrapper_impl(From)]
pub struct TestWrapperComplex<'a, 'b> {
inner: String,
_a: ::core::marker::PhantomData<&'a ()>,
_b: ::core::marker::PhantomData<&'b ()>,
}
);
```
## v0.2.0
- The following syntax is no longer accepted:
```rust,compile_fail
wrapper_lite::wrapper!(
pub ExampleWrapper(u8)
);
```
Instead, please use standard Rust struct syntax:
```rust
wrapper_lite::wrapper!(
pub struct ExampleWrapper(u8);
);
```
## v0.1.1
None
## v0.1.0
None