I have a generic function that logs some data into a binary file for a user. Naturally, I need to know how many bits the type needs. This is easy to do for most types. However, I’m unclear on what to do when the user passes in an enum. I expect that I’ll need to call
Base.Enums.basetype on the data in order to determine the bits necessary for logging it, but without knowing if it’s an enum already, how would I know I need to call that? I think I need an
isenum function or something.
For most other types, I call
eltype to return something like Float64, Int8, etc., but
Any for an enum.