Currently the SerializerState and DeserializerState is not passed to advancing methods such as next_key or next. This is done because the current stack of sinks or serializer handles is held within the state. This in turn causes challenges with lifetimes.
There are however quite a few reasons why one would want to access the state. In particular when trying to flatten serializable structures the only workaround to the lack of state is to eagerly fetch the inner struct serializers. This is possible, but causes the inner serializer to be invoked with the completely wrong state.
Currently the
SerializerState
andDeserializerState
is not passed to advancing methods such asnext_key
ornext
. This is done because the current stack of sinks or serializer handles is held within the state. This in turn causes challenges with lifetimes.There are however quite a few reasons why one would want to access the state. In particular when trying to flatten serializable structures the only workaround to the lack of state is to eagerly fetch the inner struct serializers. This is possible, but causes the inner serializer to be invoked with the completely wrong state.