Documentation
¶
Index ¶
- Variables
- func InternBytesToString(b []byte) string
- func InternString(s string) string
- func InternStringSlice(slice []string)
- type InternBuilder
- type TestMapMessage
- func (*TestMapMessage) Descriptor() ([]byte, []int)
- func (m *TestMapMessage) GetCounters() map[string]int64
- func (m *TestMapMessage) GetMetadata() map[string]string
- func (m *TestMapMessage) GetName() string
- func (m *TestMapMessage) InternStrings()
- func (m *TestMapMessage) Marshal() (dAtA []byte, err error)
- func (m *TestMapMessage) MarshalTo(dAtA []byte) (int, error)
- func (m *TestMapMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)
- func (*TestMapMessage) Poolable()
- func (*TestMapMessage) ProtoMessage()
- func (m *TestMapMessage) Reset()
- func (m *TestMapMessage) ResetPool()
- func (m *TestMapMessage) ReturnToPool()
- func (m *TestMapMessage) Size() (n int)
- func (m *TestMapMessage) String() string
- func (m *TestMapMessage) Unmarshal(dAtA []byte) error
- func (m *TestMapMessage) XXX_DiscardUnknown()
- func (m *TestMapMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
- func (m *TestMapMessage) XXX_Merge(src proto.Message)
- func (m *TestMapMessage) XXX_Size() int
- func (m *TestMapMessage) XXX_Unmarshal(b []byte) error
Constants ¶
This section is empty.
Variables ¶
Functions ¶
func InternBytesToString ¶
InternBytesToString converts bytes to an interned string without allocation.
func InternString ¶
InternString returns an interned version of the given string using Go's unique package.
func InternStringSlice ¶
func InternStringSlice(slice []string)
InternStringSlice interns all strings in the slice in-place.
Types ¶
type InternBuilder ¶
type InternBuilder struct {
// contains filtered or unexported fields
}
InternBuilder is a strings.Builder that automatically interns the final string.
func (*InternBuilder) String ¶
func (ib *InternBuilder) String() string
String returns the interned string and resets the builder.
func (*InternBuilder) WriteByte ¶
func (ib *InternBuilder) WriteByte(c byte) error
WriteByte writes a byte to the InternBuilder.
func (*InternBuilder) WriteString ¶
func (ib *InternBuilder) WriteString(s string) (int, error)
WriteString writes a string to the InternBuilder.
type TestMapMessage ¶
type TestMapMessage struct {
// Map with both string keys and values - intern both
Metadata map[string]string `` /* 157-byte string literal not displayed */
// Map with string keys, int values - intern only keys
Counters map[string]int64 `` /* 158-byte string literal not displayed */
// Regular string field for comparison
Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"`
XXX_NoUnkeyedLiteral struct{} `json:"-"`
XXX_unrecognized []byte `json:"-"`
XXX_sizecache int32 `json:"-"`
}
func TestMapMessageFromPool ¶
func TestMapMessageFromPool() *TestMapMessage
TestMapMessageFromPool retrieves a TestMapMessage from the object pool.
func UnmarshalTestMapMessageFromPool ¶
func UnmarshalTestMapMessageFromPool(data []byte) (*TestMapMessage, error)
UnmarshalTestMapMessageFromPool unmarshals data using a pooled TestMapMessage instance. The message is automatically returned to the pool if unmarshaling fails. Caller must call ReturnToPool() when done with the message.
func (*TestMapMessage) Descriptor ¶
func (*TestMapMessage) Descriptor() ([]byte, []int)
func (*TestMapMessage) GetCounters ¶
func (m *TestMapMessage) GetCounters() map[string]int64
func (*TestMapMessage) GetMetadata ¶
func (m *TestMapMessage) GetMetadata() map[string]string
func (*TestMapMessage) GetName ¶
func (m *TestMapMessage) GetName() string
func (*TestMapMessage) InternStrings ¶
func (m *TestMapMessage) InternStrings()
InternStrings interns all string fields in TestMapMessage that are configured for interning.
func (*TestMapMessage) Marshal ¶
func (m *TestMapMessage) Marshal() (dAtA []byte, err error)
func (*TestMapMessage) MarshalToSizedBuffer ¶
func (m *TestMapMessage) MarshalToSizedBuffer(dAtA []byte) (int, error)
func (*TestMapMessage) Poolable ¶
func (*TestMapMessage) Poolable()
Poolable marks this message as supporting object pooling. This is used by gRPC interceptors and other pool-aware code.
func (*TestMapMessage) ProtoMessage ¶
func (*TestMapMessage) ProtoMessage()
func (*TestMapMessage) Reset ¶
func (m *TestMapMessage) Reset()
func (*TestMapMessage) ResetPool ¶
func (m *TestMapMessage) ResetPool()
ResetPool resets the TestMapMessage fields while preserving slice capacities for pooling.
func (*TestMapMessage) ReturnToPool ¶
func (m *TestMapMessage) ReturnToPool()
ReturnToPool returns the TestMapMessage to the object pool after resetting it. Messages larger than 65536 bytes are not pooled to prevent memory bloat.
func (*TestMapMessage) Size ¶
func (m *TestMapMessage) Size() (n int)
func (*TestMapMessage) String ¶
func (m *TestMapMessage) String() string
func (*TestMapMessage) Unmarshal ¶
func (m *TestMapMessage) Unmarshal(dAtA []byte) error
func (*TestMapMessage) XXX_DiscardUnknown ¶
func (m *TestMapMessage) XXX_DiscardUnknown()
func (*TestMapMessage) XXX_Marshal ¶
func (m *TestMapMessage) XXX_Marshal(b []byte, deterministic bool) ([]byte, error)
func (*TestMapMessage) XXX_Merge ¶
func (m *TestMapMessage) XXX_Merge(src proto.Message)
func (*TestMapMessage) XXX_Size ¶
func (m *TestMapMessage) XXX_Size() int
func (*TestMapMessage) XXX_Unmarshal ¶
func (m *TestMapMessage) XXX_Unmarshal(b []byte) error