Why do the
tokio_io::codec::Decoder::decode methods have the
&mut self argument? In fact, why do they have a
self reference argument at all?
In all the implementations I’ve seen (including my own), there are no mutations of
self since there are no fields to mutate.
I may be wrong, but when you put an &mut self parameter in a parser-like struct method, the answer is almost always “to allow caching state between parser invocations” .