The statistical-inference approach to generalized thermodynamics