MCPcopy Create free account
hub / github.com/chronoxor/FastBinaryEncoding / clone

Method clone

projects/JavaScript/proto/test.js:21470–21479  ·  view source on GitHub ↗

* Clone struct (deep clone) * @this {!StructHash} * @returns {!StructHash} Cloned struct

()

Source from the content-addressed store, hash-verified

21468 * @returns {!StructHash} Cloned struct
21469 */
21470 clone () {
21471 // Serialize the struct to the FBE stream
21472 let writer = new StructHashModel(new fbe.WriteBuffer())
21473 writer.serialize(this)
21474
21475 // Deserialize the struct from the FBE stream
21476 let reader = new StructHashModel(new fbe.ReadBuffer())
21477 reader.attachBuffer(writer.buffer)
21478 return reader.deserialize().value
21479 }
21480
21481 /**
21482 * Is this struct equal to other one?

Callers

nothing calls this directly

Calls 3

serializeMethod · 0.95
deserializeMethod · 0.95
attachBufferMethod · 0.45

Tested by

no test coverage detected