zbus-old
zbus-old copied to clipboard
MessageBuilder related work
In GitLab by @danieldg on Aug 29, 2021, 03:25
Ideas for future work:
- Bind a Message to a Connection so the serial number gets set in MessageBuilder
- Parse out the header of a Message in the struct during decoding. This would allow making
MessageFieldsprivate and have all access to headers be via method on Message that returnOptions instead ofResult<Option<HeaderValue>>. Might get some minor speedups from having the values pre-parsed.
See !364
In GitLab by @danieldg on Sep 29, 2021, 02:39
The second part was mostly done by !391 - though we could perhaps improve that by making those method not return Result as they are not supposed to fail give a valid Message (and all Message objects should be valid).
This would allow making
MessageFieldsprivate and have all access to headers be via method on Message that returnOptions instead ofResult<Option<HeaderValue>>
Not sure this is a good idea. How would header attribute of dbus_interface methods work then? You'd need individual attributes for each field passed separately then. OTOH if we keep MessageFields around, I'm wondering why the message header/fields API can't be modified to always keep the headers in the decoded form (rather than Message doing that)?
In GitLab by @danieldg on Sep 29, 2021, 17:52
You could swap that out for a message attribute instead. Or make a wrapper around Message (distinct from MessageFields) that only allows access to the header, but I don't see a need for that.
I think I'm going to postpone this for zbus 3.0 because:
- Most important bits of this are already in place, I believe.
- It's mostly about convenience of the low-level API and I think that's already pretty convenient so don't think this is very high priority.
- Attaching the message to a connection, needs further thinking since so far, message and connection have been very detached from each other.
- @danieldg neither you, nor I have lately been able to get much time for zbus dev and 2.0 has been pending for more than 6 months at least.