dtolnay / dtolnay/readonly

Error on pattern destructuring on readonly structs

Open
#4 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Rust
Stars
267
Forks
12
PR merge metrics
No merged PRs in 30d

Description

First, I love this crate and I am using it everywhere.

I've this scenario where
```rust
#[readonly::make]
#[derive(Debug, Default)]
pub struct TallySpecificType {
pub a_field: usize,
}
```

And somewhere along the way, I want to
```rust
let TallySpecificType { a_field } = some_tally_specific_type;
```

But I get erros on `a_field` being a private-field. I understand that this prevents me from constructing this struct "outside" of
it, which is something I want to keep, but the destructuring should be possible irregardless.

What am I missing here? Some `&*`? Or is there as misunderstanding somehow?

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.