| 140 | } |
| 141 | |
| 142 | Result<std::shared_ptr<Buffer>> Buffer::ViewOrCopy( |
| 143 | std::shared_ptr<Buffer> source, const std::shared_ptr<MemoryManager>& to) { |
| 144 | auto maybe_buffer = MemoryManager::ViewBuffer(source, to); |
| 145 | if (maybe_buffer.ok()) { |
| 146 | return maybe_buffer; |
| 147 | } |
| 148 | return MemoryManager::CopyBuffer(source, to); |
| 149 | } |
| 150 | |
| 151 | std::shared_ptr<Buffer> Buffer::FromString(std::string data) { |
| 152 | if (data.empty()) { |