mozilla/rust — pull request #3620 by erickt (2012-09-28 06:52:31+00:00)
Title: Splitting serialization2 into a serializer and deserializer trait

Some types don't make sense to deserialize, such as `&str` types. This patch moves `deserialize` out of `Serializable` into it's own trait, and adds support for the following types:

```
char
&str
@str
&[T]
@[T]
```

It also adds an explicit `emit_struct` and `read_struct` that passes along the struct name to the Serializer/Deserializer.

It doesn't yet include the "pass-the-serializer-in-a-a-trait-typarm" that @nikomatsakis and I were talking about in IRC, as that seems to trip over an ICE.

It also includes a small patch that renames `vec::raw::from_slice` into `vec::raw::buf_as_slice`, which matches `str::raw::buf_as_slice` and a small bit of cleanup.