Documentation ¶
Overview ¶
Package safe provides some thread safe types, wrapping builtin types.
Index ¶
- type Buffer
- func (sb *Buffer) Bytes() []byte
- func (sb *Buffer) Len() int
- func (sb *Buffer) Next(n int) []byte
- func (sb *Buffer) Read(p []byte) (int, error)
- func (sb *Buffer) ReadByte() (byte, error)
- func (sb *Buffer) ReadBytes(delim byte) ([]byte, error)
- func (sb *Buffer) ReadFrom(r io.Reader) (int64, error)
- func (sb *Buffer) ReadRune() (rune, int, error)
- func (sb *Buffer) ReadString(delim byte) (string, error)
- func (sb *Buffer) Reset()
- func (sb *Buffer) String() string
- func (sb *Buffer) Truncate(n int)
- func (sb *Buffer) UnreadByte() error
- func (sb *Buffer) UnreadRune() error
- func (sb *Buffer) Write(p []byte) (int, error)
- func (sb *Buffer) WriteByte(c byte) error
- func (sb *Buffer) WriteRune(r rune) (int, error)
- func (sb *Buffer) WriteString(s string) (int, error)
- func (sb *Buffer) WriteTo(w io.Writer) (int64, error)
- type BytesReader
- func (r *BytesReader) Len() int
- func (r *BytesReader) Read(b []byte) (int, error)
- func (r *BytesReader) ReadAt(b []byte, off int64) (int, error)
- func (r *BytesReader) ReadByte() (byte, error)
- func (r *BytesReader) ReadRune() (rune, int, error)
- func (r *BytesReader) Seek(offset int64, whence int) (int64, error)
- func (r *BytesReader) UnreadByte() error
- func (r *BytesReader) UnreadRune() error
- func (r *BytesReader) WriteTo(w io.Writer) (int64, error)
- type Counter
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Buffer ¶
type Buffer struct {
// contains filtered or unexported fields
}
Buffer is a thread safe version of bytes.Buffer.
func (*Buffer) UnreadByte ¶
func (*Buffer) UnreadRune ¶
type BytesReader ¶
type BytesReader struct {
// contains filtered or unexported fields
}
BytesReader is a thread safe version of bytes.Reader.
func NewBytesReader ¶
func NewBytesReader(b []byte) *BytesReader
func (*BytesReader) Len ¶
func (r *BytesReader) Len() int
func (*BytesReader) ReadByte ¶
func (r *BytesReader) ReadByte() (byte, error)
func (*BytesReader) UnreadByte ¶
func (r *BytesReader) UnreadByte() error
func (*BytesReader) UnreadRune ¶
func (r *BytesReader) UnreadRune() error
type Counter ¶
type Counter struct {
// contains filtered or unexported fields
}
Counter implements a thread-safe, lock-free counter, that supports operations like increment and decrement.
It uses an int64 internally, so all int64 boundaries also apply here.
func NewCounter ¶
NewCounter creates a new counter with the given value as the initial value.
Click to show internal directories.
Click to hide internal directories.