-
Notifications
You must be signed in to change notification settings - Fork 236
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Remove requirement to have Reader when decoding attributes and write anything converted to Event #760
Conversation
Codecov ReportAttention: Patch coverage is
❗ Your organization needs to install the Codecov GitHub app to enable full functionality. Additional details and impacted files@@ Coverage Diff @@
## master #760 +/- ##
==========================================
- Coverage 61.81% 60.30% -1.52%
==========================================
Files 41 41
Lines 16798 16191 -607
==========================================
- Hits 10384 9764 -620
- Misses 6414 6427 +13
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
This will allow decode them even if Reader does not exists, for example, when you only write events.
…wnership This change will allow to feed to the writer different structs which, otherwise, would be impossible if are not holds an `Event` inside your struct. In the future the Event may be split into `reader::Event` and `writer::Event` and the reader variant may evolve to be borrow-only.
Usability of the last commit can be demonstrated in #766. There I plan to introduce conception of low-level I plan to make |
@Mingun is it possible to go the opposite direction, i.e. have |
Yes, it will be done that way. |
This PR includes two changes, which both related to my work of splitting event into two event classes -- for reading and for writing. Events for reading then would only borrow data and this will help to fix #332 and also open doors to
no_std
reader (not sure why it would be needed although).The first commit just removes unused import that I noticed while working on this.
The second commit relaxes requirements for decoding values from
Attribute
. If you created attribute for writing and then for whatever reason wants to read its value back, you need aReader
which you does not have. This commit fixes that.The third commit makes writing methods take
Into<Event>
instead ofAsRef<Event>
. The former trait give a lesser abilities thenInto
. It allows you to pass your own struct to write, but you need to have event in your struct to be able to take a ref to it.Into
would allow you to construct event on demand and also would allow to directly pass reader event to the writer method that would require writer event if (when?) event splitting will be implemented. In any case, I think, that takingInto
is better.If there are any objections, then unnecessary commits can be removed from PR.