`tokio_io::codec::{Encoder, Decoder}` method prototypes


Why do the tokio_io::codec::Encoder::encode and 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” .


The docs for Decoder mention it: