You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Improvement to the linera-views-derive code (#4421)
## Motivation
The code in `lib.rs` has several failure scenarios that result in
crashes, panics, or other errors.
Fixes#744
## Proposal
It is completely possible to implement views for unnamed structs, that
is:
```rust
pub struct CounterState(pub RegisterView<u64>);
```
However, we choose to make this illegal. The reason is that this kind of
structs would not be used in the protocol code and it is also not
allowed by `async_graphql::SimpleObject`.
What this PR does is to add several error patterns without panic to the
macro code:
* Unnamed structs lead to explicit error.
* Track the error produced by `RegisterView<u64>` which can be produced
by missing Context or by missing view macro.
* structs must have at least one entry.
## Test Plan
The CI.
## Release Plan
- Nothing to do / These changes follow the usual release cycle.
## Links
None.
0 commit comments