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

Method clone

projects/JavaScript/proto/test.js:1859–1868  ·  view source on GitHub ↗

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

()

Source from the content-addressed store, hash-verified

1857 * @returns {!StructSimple} Cloned struct
1858 */
1859 clone () {
1860 // Serialize the struct to the FBE stream
1861 let writer = new StructSimpleModel(new fbe.WriteBuffer())
1862 writer.serialize(this)
1863
1864 // Deserialize the struct from the FBE stream
1865 let reader = new StructSimpleModel(new fbe.ReadBuffer())
1866 reader.attachBuffer(writer.buffer)
1867 return reader.deserialize().value
1868 }
1869
1870 /**
1871 * 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