iorw

package
v1.3.10 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2024 License: MIT Imports: 13 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 added in v1.3.0

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

func ExpandRuneIndexFn added in v1.3.0

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

Returns index where truth was found.

func ExpandRuneLastIndexFn added in v1.3.0

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 HasSuffix added in v1.3.7

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

func Index

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

func IndexCtx

func IndexCtx(ctx context.Context, r ReaderAt, i int, sep []byte, opt *IndexOpt) (index int, n int, _ error)

Returns (-1, 0, nil) if not found.

func IsWordRune

func IsWordRune(ru rune) bool

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

func LastIndex added in v1.3.4

func LastIndex(r ReaderAt, i int, sep []byte, ignoreCase bool) (int, int, error)

func LastIndexCtx added in v1.3.4

func LastIndexCtx(ctx context.Context, r ReaderAt, i int, sep []byte, opt *IndexOpt) (int, int, error)

Returns (-1, 0, nil) if not found.

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 NewScanner added in v1.3.7

func NewScanner(rd ReaderAt) *pscan.Scanner

func NewlineIndex added in v1.3.0

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

func NewlineLastIndex added in v1.3.0

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

func REqual added in v1.3.0

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

func ReadFastFull added in v1.3.0

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

Result might not be a copy.

func ReadFullCopy added in v1.3.0

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

Result might not be a copy.

func ReadLastRuneAt added in v1.3.0

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

func ReadRuneAt added in v1.3.0

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 added in v1.3.0

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 added in v1.3.0

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 added in v1.3.0

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

func SetString

func SetString(rw ReadWriterAt, s string) error

func WordAtIndex

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

func WordIsolated

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

Types

type BytesReadWriterAt added in v1.3.0

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

func NewBytesReadWriterAt added in v1.3.0

func NewBytesReadWriterAt(b []byte) *BytesReadWriterAt

func (*BytesReadWriterAt) Max added in v1.3.0

func (rw *BytesReadWriterAt) Max() int

Implement ReaderAt

func (*BytesReadWriterAt) Min added in v1.3.0

func (rw *BytesReadWriterAt) Min() int

Implement ReaderAt

func (*BytesReadWriterAt) OverwriteAt added in v1.3.0

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

Implement WriterAt

func (*BytesReadWriterAt) ReadFastAt added in v1.3.0

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

Implement ReaderAt

type IndexOpt added in v1.3.4

type IndexOpt struct {
	IgnoreCase           bool
	IgnoreCaseDiacritics bool // also lower the case of diacritics (slow)
	IgnoreDiacritics     bool
}

func (*IndexOpt) IgnoringDiacritics added in v1.3.4

func (opt *IndexOpt) IgnoringDiacritics() bool

type LimitedReaderAt added in v1.3.0

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

func NewLimitedReaderAt added in v1.3.0

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

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

func NewLimitedReaderAtPad added in v1.3.0

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

func (*LimitedReaderAt) Max added in v1.3.0

func (r *LimitedReaderAt) Max() int

func (*LimitedReaderAt) Min added in v1.3.0

func (r *LimitedReaderAt) Min() int

func (*LimitedReaderAt) ReadFastAt added in v1.3.0

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

type RWEvPreWrite added in v1.3.0

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

type RWEvWrite added in v1.3.0

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

type RWEvWrite2 added in v1.3.0

type RWEvWrite2 struct {
	RWEvWrite
	Changed bool
}

type RWEvents added in v1.3.0

type RWEvents struct {
	ReadWriterAt
	EvReg evreg.Register
}

Runs callbacks on operations.

func NewRWEvents added in v1.3.0

func NewRWEvents(rw ReadWriterAt) *RWEvents

func (*RWEvents) OverwriteAt added in v1.3.0

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

type ReadWriterAt added in v1.3.0

type ReadWriterAt interface {
	ReaderAt
	WriterAt
}

type ReaderAt added in v1.3.0

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 added in v1.3.0

func NewStringReaderAt(s string) ReaderAt

type WriterAt added in v1.3.0

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