Use result::unwrap which doesn't copy the string
Implement serialize::Encoder trait

Can use #[auto_encode] feature now.