The variant itself would be private if possible, this is the solution closest to that.
ruma-events contains serializable types for the events in the Matrix specification that can be shared by client and server code.