MCPcopy
hub / github.com/grpc/grpc-go / CustomCodec

Function CustomCodec

server.go:364–368  ·  view source on GitHub ↗

CustomCodec returns a ServerOption that sets a codec for message marshaling and unmarshaling. This will override any lookups by content-subtype for Codecs registered with RegisterCodec. Deprecated: register codecs using encoding.RegisterCodec. The server will automatically use registered codecs ba

(codec Codec)

Source from the content-addressed store, hash-verified

362// https://github.com/grpc/grpc-go/blob/master/Documentation/encoding.md#using-a-codec.
363// Will be supported throughout 1.x.
364func CustomCodec(codec Codec) ServerOption {
365 return newFuncServerOption(func(o *serverOptions) {
366 o.codec = newCodecV0Bridge(codec)
367 })
368}
369
370// ForceServerCodec returns a ServerOption that sets a codec for message
371// marshaling and unmarshaling.

Callers 1

startBenchmarkServerFunction · 0.92

Calls 2

newFuncServerOptionFunction · 0.85
newCodecV0BridgeFunction · 0.85

Tested by

no test coverage detected