| 91 | /// Serializes obj into result. Result will contain a copy of the memory. |
| 92 | template <class T> |
| 93 | Status SerializeToVector(const T* obj, std::vector<uint8_t>* result) { |
| 94 | uint32_t len; |
| 95 | uint8_t* buffer; |
| 96 | RETURN_IF_ERROR(SerializeToBuffer(obj, &len, &buffer)); |
| 97 | result->assign(buffer, buffer + len); |
| 98 | return Status::OK(); |
| 99 | } |
| 100 | |
| 101 | /// Serialize obj into a memory buffer. The result is returned in buffer/len. The |
| 102 | /// memory returned is owned by this object and will be invalid when another object |