MCPcopy Create free account
hub / github.com/apache/fory / serialize

Method serialize

cpp/fory/serialization/fory.h:550–562  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

548 /// @return Vector containing serialized bytes, or error.
549 template <typename T>
550 Result<std::vector<uint8_t>, Error> serialize(const T &obj) {
551 if (FORY_PREDICT_FALSE(!finalized_)) {
552 ensure_finalized();
553 }
554 WriteContextGuard guard(*write_ctx_);
555 Buffer &buffer = write_ctx_->buffer();
556
557 FORY_RETURN_NOT_OK(serialize_impl(obj, buffer));
558
559 std::vector<uint8_t> result(buffer.writer_index());
560 std::memcpy(result.data(), buffer.data(), buffer.writer_index());
561 return result;
562 }
563
564 /// Serialize an object to an output stream.
565 ///

Callers

nothing calls this directly

Calls 14

UnexpectedClass · 0.85
writer_indexMethod · 0.80
set_output_streamMethod · 0.80
bind_output_streamMethod · 0.80
clear_output_streamMethod · 0.80
flushed_bytesMethod · 0.80
resetMethod · 0.65
errorMethod · 0.65
bufferMethod · 0.45
dataMethod · 0.45
okMethod · 0.45
force_flushMethod · 0.45

Tested by

no test coverage detected