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

Function ExampleAttributes_WithValue

attributes/attributes_test.go:56–66  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

54}
55
56func ExampleAttributes_WithValue() {
57 type keyOne struct{}
58 type keyTwo struct{}
59 a := attributes.New(keyOne{}, 1)
60 a = a.WithValue(keyTwo{}, stringVal{s: "two"})
61 fmt.Println("Key one:", a.Value(keyOne{}))
62 fmt.Println("Key two:", a.Value(keyTwo{}))
63 // Output:
64 // Key one: 1
65 // Key two: {two}
66}
67
68func ExampleAttributes_String() {
69 type key struct{}

Callers

nothing calls this directly

Calls 4

NewFunction · 0.92
WithValueMethod · 0.80
PrintlnMethod · 0.80
ValueMethod · 0.45

Tested by

no test coverage detected