iorw

package
v2.0.0-...-7f6935a Latest Latest
Warning

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

Go to latest
Published: May 5, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RWEvIdWrite    = iota // ev=RWEvWrite
	RWEvIdWrite2          // ev=RWEvWrite2
	RWEvIdPreWrite        // ev=RWEvPreWrite
)
View Source
const EndRune = -1

Variables

This section is empty.

Functions

func Append

func Append(rw ReadWriterAt, b []byte) error

func ExpandRuneIndexFn

func ExpandRuneIndexFn(r ReaderAt, i int, truth bool, f func(rune) bool) int

// Returns index where truth was found.

func ExpandRuneLastIndexFn

func ExpandRuneLastIndexFn(r ReaderAt, i int, truth bool, f func(rune) bool) int

Returns last index before truth was found.

func HasPrefix

func HasPrefix(r ReaderAt, i int, s []byte) bool

func Index

func Index(r ReaderAt, i int, sep []byte, toLower bool) (int, error)

func IndexCtx

func IndexCtx(ctx context.Context, r ReaderAt, i int, sep []byte, toLower bool) (int, error)

Returns (-1, nil) if not found.

func IsWordRune

func IsWordRune(ru rune) bool

Also used at: selectword, movecursorjump{left,right}

func LineEndIndex

func LineEndIndex(r ReaderAt, i int) (int, bool, error)

index after '\n' (with isNewLine true), or max index

func LineStartIndex

func LineStartIndex(r ReaderAt, i int) (int, error)

func LinesIndexes

func LinesIndexes(r ReaderAt, a, b int) (int, int, bool, error)

func MakeBytesCopy

func MakeBytesCopy(b []byte) []byte

func NewlineIndex

func NewlineIndex(r ReaderAt, i int) (int, int, error)

func NewlineLastIndex

func NewlineLastIndex(r ReaderAt, i int) (int, int, error)

func REqual

func REqual(r ReaderAt, i, n int, p []byte) (bool, error)

func ReadFastFull

func ReadFastFull(rd ReaderAt) ([]byte, error)

Result might not be a copy.

func ReadFullCopy

func ReadFullCopy(rd ReaderAt) ([]byte, error)

Result might not be a copy.

func ReadLastRuneAt

func ReadLastRuneAt(r ReaderAt, i int) (rune, int, error)

func ReadRuneAt

func ReadRuneAt(r ReaderAt, i int) (rune, int, error)

func ReaderIter

func ReaderIter(r ReaderAt, fn func(i int, ru rune) bool) error

Iterate over n+1 runes, with the last rune being eofRune(-1).

func RuneIndexFn

func RuneIndexFn(r ReaderAt, i int, truth bool, f func(rune) bool) (index, size int, err error)

On error, returns best failing index. Use errors.Is(err, io.EOF) to handle limitedreaders.

func RuneLastIndexFn

func RuneLastIndexFn(r ReaderAt, i int, truth bool, f func(rune) bool) (index, size int, err error)

On error, returns best failing index. Use errors.Is(err, io.EOF) to handle limitedreaders.

func SetBytes

func SetBytes(rw ReadWriterAt, b []byte) error

func SetString

func SetString(rw ReadWriterAt, s string) error

func ToLowerAsciiCopy

func ToLowerAsciiCopy(p []byte) []byte

Lower case at byte level without expanding in size the resulting byte slice.

func WordAtIndex

func WordAtIndex(r ReaderAt, index int) ([]byte, int, error)

func WordIsolated

func WordIsolated(r ReaderAt, i, le int) bool

Types

type BytesReadWriterAt

type BytesReadWriterAt struct {
	// contains filtered or unexported fields
}

func NewBytesReadWriterAt

func NewBytesReadWriterAt(b []byte) *BytesReadWriterAt

func (*BytesReadWriterAt) Max

func (rw *BytesReadWriterAt) Max() int

Implement ReaderAt

func (*BytesReadWriterAt) Min

func (rw *BytesReadWriterAt) Min() int

Implement ReaderAt

func (*BytesReadWriterAt) OverwriteAt

func (rw *BytesReadWriterAt) OverwriteAt(i, del int, p []byte) error

Implement WriterAt

func (*BytesReadWriterAt) ReadFastAt

func (rw *BytesReadWriterAt) ReadFastAt(i, n int) ([]byte, error)

Implement ReaderAt

type LimitedReaderAt

type LimitedReaderAt struct {
	ReaderAt
	// contains filtered or unexported fields
}

func NewLimitedReaderAt

func NewLimitedReaderAt(r ReaderAt, min, max int) *LimitedReaderAt

min<=max; allows arguments min<0 && max>length

func NewLimitedReaderAtPad

func NewLimitedReaderAtPad(r ReaderAt, min, max, pad int) *LimitedReaderAt

func (*LimitedReaderAt) Max

func (r *LimitedReaderAt) Max() int

func (*LimitedReaderAt) Min

func (r *LimitedReaderAt) Min() int

func (*LimitedReaderAt) ReadFastAt

func (r *LimitedReaderAt) ReadFastAt(i, n int) ([]byte, error)

type RWEvPreWrite

type RWEvPreWrite struct {
	Index    int
	N        int
	P        []byte
	ReplyErr error // can be set by any caller to cancel the write
}

type RWEvWrite

type RWEvWrite struct {
	Index int
	Dn    int // n deleted bytes
	In    int // n inserted bytes
}

type RWEvWrite2

type RWEvWrite2 struct {
	RWEvWrite
	Changed bool
}

type RWEvents

type RWEvents struct {
	ReadWriterAt
	EvReg evreg.Register
}

Runs callbacks on operations.

func NewRWEvents

func NewRWEvents(rw ReadWriterAt) *RWEvents

func (*RWEvents) OverwriteAt

func (rw *RWEvents) OverwriteAt(i, n int, p []byte) error

type ReadWriterAt

type ReadWriterAt interface {
	ReaderAt
	WriterAt
}

type ReaderAt

type ReaderAt interface {
	ReadFastAt(i, n int) ([]byte, error) // not a copy; might read less then n
	// indexes: min>=0 && min<=max && max<=length
	Min() int
	Max() int
}

func NewStringReaderAt

func NewStringReaderAt(s string) ReaderAt

type WriterAt

type WriterAt interface {
	// insert: Overwrite(i, 0, p)
	// delete: Overwrite(i, n, nil)
	OverwriteAt(i, del int, p []byte) error // writes len(p)
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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