Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cloner ¶
Cloner knows how to make copies of messages. It can be asked to copy one value into another, and it can also be asked to simply synthesize a new value that is a copy of some input value.
This is used to copy messages between in-process client and server. Copying will usually be more efficient than marshalling to bytes and back (though that is a valid strategy that a custom Cloner implementation could take). Copies are made to avoid sharing values across client and server goroutines.
func CloneFunc ¶
CloneFunc adapts a single clone function to the Cloner interface. The given function implements the Clone method. To implement the Copy method, the given function is invoked and then reflection is used to shallow copy the clone to the output.
func CodecCloner ¶
CodecCloner uses the given codec to implement the Cloner interface. The Copy method is implemented by using the code to marshal the input to bytes and then unmarshal from bytes into the output value. The Clone method then uses reflection to create a new value of the same type and uses this strategy to then copy the input to the newly created value.