Moved write_to_protobuf outside of datum_t.