bytes

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 7, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var DummyWriter = &nopWriter{}

Functions

func AcceptEOF

func AcceptEOF(count int, c byte, err error) (int, bool, byte, error)

func ConsumeEscaped

func ConsumeEscaped(r io.ByteReader, w io.ByteWriter, plan string) error

func ConsumeUntil

func ConsumeUntil(r io.ByteReader, w io.ByteWriter, stop func(byte) bool) (int, byte, error)

func ExpectChar

func ExpectChar(r io.ByteReader, c byte) error

func ExpectHexChar

func ExpectHexChar(r io.ByteReader) (byte, error)

func ExpectOctCharExt

func ExpectOctCharExt(b0 byte, r io.ByteReader) (byte, error)

func ExpectUnicodeChar

func ExpectUnicodeChar(r io.ByteReader) (rune, error)

func IgnoreCount

func IgnoreCount(_ int, c byte, err error) (byte, error)

func ReadRune

func ReadRune(r io.ByteReader) (rune, int)

func ReadRuneExt

func ReadRuneExt(b0 byte, r io.ByteReader) (rune, int)

func ScannedBytes

func ScannedBytes(s *MarkScanner, mark int, eof bool) []byte

func Skip

func Skip(r io.ByteReader, expect func(byte) bool) (int, byte, error)

func Unread

func Unread(r io.ByteScanner, eof bool, err error) error

func UnsafeAt

func UnsafeAt[T []byte | string](s T, pos int) byte

UnsafeAt implements the same functionality as `s[pos]`, but without bounds check.

func UnsafeFromString

func UnsafeFromString(s string) []byte

func UnsafeSlice

func UnsafeSlice[T []byte | string](s T, lo int, hi int) []byte

UnsafeSlice implements the same functionality as `s[lo:hi]`, but without bounds check.

func UnsafeToString

func UnsafeToString(b []byte) string

func WriteRune

func WriteRune(w io.ByteWriter, ru rune) error

Types

type CopyOnDiffWriter

type CopyOnDiffWriter struct {
	Buf []byte
	// contains filtered or unexported fields
}

func (*CopyOnDiffWriter) Bytes

func (w *CopyOnDiffWriter) Bytes() []byte

func (*CopyOnDiffWriter) WriteByte

func (w *CopyOnDiffWriter) WriteByte(c byte) error

type LastByteWriter

type LastByteWriter interface {
	io.Writer

	LastByte() (byte, bool)
	TruncateLastByte()
}

type MarkScanner

type MarkScanner struct {
	Buf []byte
	// contains filtered or unexported fields
}

func NewMarkScanner

func NewMarkScanner(b []byte) *MarkScanner

func (*MarkScanner) From

func (s *MarkScanner) From(mark int) []byte

func (*MarkScanner) Mark

func (s *MarkScanner) Mark(off int) int

func (*MarkScanner) ReadByte

func (s *MarkScanner) ReadByte() (byte, error)

func (*MarkScanner) Resume

func (s *MarkScanner) Resume(mark int) error

func (*MarkScanner) Since

func (s *MarkScanner) Since(mark int, off int) []byte

func (*MarkScanner) UnreadByte

func (s *MarkScanner) UnreadByte() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL