MarshalMsg() and AppendMsg()

This is the marshaling corollary to the last PR. As a prerequisite to this, objects had to guess their own encoded size, hence the `Maxsize()` method.