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

Function ExampleAttributes

attributes/attributes_test.go:45–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

43}
44
45func ExampleAttributes() {
46 type keyOne struct{}
47 type keyTwo struct{}
48 a := attributes.New(keyOne{}, 1).WithValue(keyTwo{}, stringVal{s: "two"})
49 fmt.Println("Key one:", a.Value(keyOne{}))
50 fmt.Println("Key two:", a.Value(keyTwo{}))
51 // Output:
52 // Key one: 1
53 // Key two: {two}
54}
55
56func ExampleAttributes_WithValue() {
57 type keyOne 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