/// A MessageParser allows hotwire to parse & display messages related to
/// a certain protocol, for instance HTTP. The message parser deals with
/// parsing packets as well as displaying them.
///
/// The first step is to take TSharkPackets and build a StreamData from it.
/// The StreamData contains among other things a list of messages, which
/// the parser builds from the packets. Conceptually the MessageParser
/// trait "should" have two associated types: one for a StreamGlobals type
/// specific for the parser, and one for a MessageData type specific
/// for the parser.
/// This was attempted in the 'better_types' branch, but it complicated
/// many things, because then it was not possible to iterate over parsers
/// or over messages from different parsers.
///
/// Instead we now have a "workaround" where MessageData and StreamGlobals
/// are enums and basically each parser puts and expects to find its own
/// type. Hopefully a better solution can be found in the future.
However that forced me to have in win.rs in that branch a message_parser_visitor macro to be able to work on multiple message parsers. And also things like:
While in mainline I have a single field in both cases. Note otherwise that the better_types branch is waaaay behind mainline in other aspects of the code.
I'd like to see that we could have both the advantages of the better types of the branch and the ergonomics of mainline... (besides the fact that in mainline the enums must be "casted" to the right type)
comment on top of the
MessageParser
interface:In the
better_types
branch, I have things like:While in mainline:
However that forced me to have in win.rs in that branch a
message_parser_visitor
macro to be able to work on multiple message parsers. And also things like:While in mainline I have a single field in both cases. Note otherwise that the
better_types
branch is waaaay behind mainline in other aspects of the code.I'd like to see that we could have both the advantages of the better types of the branch and the ergonomics of mainline... (besides the fact that in mainline the enums must be "casted" to the right type)