I didn't write this code. I think it's deliberately strict? The idea is that you call this on the string ref and then later call serialize on the same one?