I think is a good idea but I have some problem with the function signature. I would like this signature
pub fn memory_encode(to_encode_object: &serialize::Encodable) -> mut MemWriter
The parameter can't be serialize::Encodable and I didn't manage to return the object and not the managed pointer.
Perhaps it's simplier to return the encoded str or the buffer. The fn can be
pub fn memory_encode(to_encode_object: &serialize::Encodable) -> ~str
I think it answer 99% of case. The 1% that need the writer to add data use the current way.