bengreenier / bengreenier/partially
[Feature Request] add field options like skip_attributes, attirbute on derive, to corporate with SmartDefault
- Dominant language
- Rust
- Stars
- 8
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
I want to use Partially together with SmartDefault:
```rust
#[derive(SmartDefault, Partial)]
pub struct Hello {
#[default(3)]
pub value: i64,
}
```
but it does not compile:
```
cannot find attribute `default` in this scop
```
change struct to :
```rust
#[derive(SmartDefault, Partial)]
#[partially(derive(SmartDefault))]
pub struct Hello {
#[default(3)]
pub value: i64,
}
```
it still does not compile:
```
mismatched types
expected enum `std::option::Option`
found type `{integer}`
(E0308)
```
change struct to:
```rust
#[derive(SmartDefault, Partial)]
#[partially(derive(SmartDefault))]
pub struct Hello {
#[default(3)]
#[partially(transparent)]
pub value: i64,
}
```
it still does not compile:
```
no method named `is_some` found for type `i64` in the current scop
method not found in `i64`
(E0599)
mismatched types
expected typ `i64`
found enum `std::option::Option<_>`
(E0308)
```
generated code does not follow `#[partially(transparent)]`, that's a bug.
Add `skip_attributes`, `attribute` as field options on derive may work.
Partially is an amazing crate on 2024, it's very useful, thanks @bengreenier
Contributor guide
No contributing guide indexed for this repository
Research direction
Start by reproducing the SmartDefault and Partial examples, including the #[partially(transparent)] field. Inspect the generated code to determine why that option is ignored, then assess the requested skip_attributes and attribute field options. Done means the documented examples compile and the requested options have clear, tested behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100