Skip to content

Commit 2c81d57

Browse files
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.
1 parent 6f94385 commit 2c81d57

File tree

1 file changed

+303
-62
lines changed

1 file changed

+303
-62
lines changed

0 commit comments

Comments
 (0)