How to show type aliases in trait impl documentation?

#1

Hi, I’m wrinting docs for the first time and I find it hard to read for traits. Concretely, I have a generic trait Optimizer<Observations, S, Delta, Model, PreEval, PartialState, E> and an implementation Optimizer<Obs, LMState, Vec6, Iso3, PreEval, LMPartialState, Float> for LMOptimizer where Vec6 and Iso3 for exemple are public type alias.

There are two things I find hard to follow in the generated doc (cargo doc):

  1. In the trait doc, the generic types are used in the “Required Methods” bloc, like fn initial_energy() -> E where E is used. But those generics are never showed at the begining of the trait doc, just “Optimizer”. This means I have to manually add a doc comment with the full trait name. I don’t mind having to comment, but it can become out of sync if not careful.
  2. In the trait impl doc of LMOptimizer it doesn’t show the public type alias names but their fully developed version. For example, instead of Optimizer<Obs, LMState, Vec6, Iso3, PreEval, LMPartialState, Float>, I get Optimizer<Obs, LMState, Matrix<f32, U6, U1, <DefaultAllocator as Allocator<f32, U6, U1>>::Buffer>, Isometry<f32, U3, Unit<Quaternion<f32>>>, (Vec<usize>, Vec<f32>, f32), Result<LMData, f32>, f32>.

Is there a way around this behavior? (doc command options?) If not, is it because of difficulties I’m not seeing of using type aliases in trait doc?

0 Likes