type Vector … func (v Vector) MarshalBinary() ([]byte, error) { … } // UnmarshalBinary modifies the receiver so it must take a pointer receiver. func (v *Vector) UnmarshalBinary(data []byte) error { … } // This example transmits a value that implements the custom encoding and decoding methods. func Example_encodeDecode() { … }