Entity is a poor wrapper
Currently, Entity
is an enum
for all the other entity types (Item
, Property
, Lexeme
, and MediaInfo
). It also exposes wrapper functions for read/write access to the "inner" type. Thus, it needs to have a superset of all methods of all types. For example, it has a sitelinks_mut
function to alter sitelinks in Items, but it works on things like Lexemes, which do not have sitelinks. As implemented right now, all the types must implement all the wrapped functions, so Lexeme
actually has a sitelinks
member, and the r/w functions to go with it.
I am not sure how to proceed here. We could add special logic to the Entity
functions, not calling eg sitelinks_mut
in Lexemes, but they need to return something writable, so some decoy member? But then it can't be an enum
anymore!
Or Entity
.sitelinks_mut
could return an Option<>
, using None for everything except Item
, but that would be a breaking change.