the more context is provided, the less assumptions are made.
architectural design is very subjective, and for this example, I would say yes, it's perfectly reasonable.
in fact, this kind of API design (passing "fat" data through a "thin" eye of needle) is very common (and sometimes necessary) at "boundaries" of systems/components/layers, one common example is the event loops of GUI application (e.g. winit::Event::UserEvent
). and to some extent, the kernel's system call can also be seen this way.
anyway, I was not saying to you should avoid merging/multiplexing different types of data through a shared channel. rather, my point was, if the design has reasons to use a shared channel, then there's nothing "wrong" about creating a sum type (a.k.a. enum
) accordingly, which is in direct response to this sentence of OP:
I have no idea, maybe out of habits or conventions (just guessing).
it's common to see adjectives for interfaces in some lanagues: Observable
, Disposable
, Inspectable
, Reducible
, Enumerable
, etc; while rust often uses "verbs" for traits, named after the traits' operations: Clone
, Read
, Drop
, ToString
, Into
, etc., as opposed to, say, Clonable
, Readable
, Droppable
, Convertible
(ToStringable
??? Intoable
???). however, "marker" traits without methods don't necessarily follow this convention, such as Unpin
, Sync
, Sized
, etc.