I'm no rust expert but isn't this sort of thing exactly what traits handle well?
Not directly relevant.