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
There might be an advantage in having a flexible payload. The same pattern as for Elements could be used (give key and value, let method decide how to store it).
If the payload builds its own elements, it could also decide from which struct type they are and hence only one parser would be needed for multi type elements.
What is the interface?
There could be a method, that creates an Element and returns it. The parser fills it as it is now and passes it back to the payload.
Not sure, how this interacts with rusts type system, returning structs of different types only conforming to a common trait seems tricky, it might not work, since the caller doesn't know how much stack space to allocate.
Instead returning the struct one might pass a mutable reference? This seems unsuitable, since the LinkedHashMap might not support this operation.
May be some kind of builder pattern?
The text was updated successfully, but these errors were encountered:
There might be an advantage in having a flexible payload. The same pattern as for Elements could be used (give key and value, let method decide how to store it).
If the payload builds its own elements, it could also decide from which struct type they are and hence only one parser would be needed for multi type elements.
What is the interface?
The text was updated successfully, but these errors were encountered: