On Wed Feb 18, 2026 at 1:05 PM JST, Eliot Courtney wrote: >>> + fn command_size<M>(command: &M) -> usize >> >> Shouldn't this be a member function of `CommandToGsp`? Please add some >> basic documentation for it as well. As a general rule, all methods, even >> basic ones, should have at least one line of doccomment. > > I thought about this, but adding a function to CommandToGsp with > a default implementation seems odd to me, because implementors of that > trait could override it, which does not really make sense. We have > command size defined as the size of the struct plus the variable payload > size. Adding a function to CommandToGsp would give two methods to > calculate the command size which could differ. So, seems weird to me. > > An alternative would be to make it a free standing function. This would > let it be used by WrappingCommand later as well. WDYT?
Using default trait methods even when they should not be overriden is common in the kernel, so I am not worried about that. But you are right that the use of this size is local to the command queue so maybe it's better to keep it as a (documented :)) method of it.
