I think you should file a rust bug about having some kind of ProfilerCategory.len() or something that will return teh number of variants. It seems weird to depend on internal behavior like this.