Documentation ¶
Index ¶
- Constants
- Variables
- func ExpandIndexFunc(r Reader, i int, truth bool, f func(rune) bool) int
- func ExpandLastIndexFunc(r Reader, i int, truth bool, f func(rune) bool) int
- func HasPrefix(r Reader, i int, s []byte) bool
- func Index(r Reader, i int, sep []byte, toLower bool) (int, error)
- func IndexCtx(ctx context.Context, r Reader, i int, sep []byte, toLower bool) (int, error)
- func IndexFunc(r Reader, i int, truth bool, f func(rune) bool) (index, size int, err error)
- func IsWordRune(ru rune) bool
- func LastIndexFunc(r Reader, i int, truth bool, f func(rune) bool) (index, size int, err error)
- func LineEndIndex(r Reader, i int) (int, bool, error)
- func LineStartIndex(r Reader, i int) (int, error)
- func LinesIndexes(r Reader, a, b int) (int, int, bool, error)
- func MMLen(rd Reader) int
- func NewLineIndex(r Reader, i int) (int, int, error)
- func NewLineLastIndex(r Reader, i int) (int, int, error)
- func ReadFullSlice(rd Reader) ([]byte, error)
- func ReaderIter(r Reader, fn func(i int, ru rune) bool) error
- func SetString(rw ReadWriter, s string) error
- func ToLowerAsciiCopy(p []byte) []byte
- func WordAtIndex(r Reader, index int) ([]byte, int, error)
- func WordIsolated(r Reader, i, le int) bool
- type BytesReadWriter
- func (rw *BytesReadWriter) Delete(i, n int) error
- func (rw *BytesReadWriter) Insert(i int, p []byte) error
- func (rw *BytesReadWriter) Max() int
- func (rw *BytesReadWriter) Min() int
- func (rw *BytesReadWriter) Overwrite(i, n int, p []byte) error
- func (rw *BytesReadWriter) ReadLastRuneAt(i int) (ru rune, size int, err error)
- func (rw *BytesReadWriter) ReadNCopyAt(i, n int) ([]byte, error)
- func (rw *BytesReadWriter) ReadNSliceAt(i, n int) ([]byte, error)
- func (rw *BytesReadWriter) ReadRuneAt(i int) (ru rune, size int, err error)
- type LimitedReader
- func (r *LimitedReader) Max() int
- func (r *LimitedReader) Min() int
- func (r *LimitedReader) ReadLastRuneAt(i int) (ru rune, size int, err error)
- func (r *LimitedReader) ReadNCopyAt(i, n int) ([]byte, error)
- func (r *LimitedReader) ReadNSliceAt(i, n int) ([]byte, error)
- func (r *LimitedReader) ReadRuneAt(i int) (ru rune, size int, err error)
- type ReadWriter
- type Reader
- type UndoRedo
- type Writer
- type WriterOp
Constants ¶
View Source
const EndRune = -1
Variables ¶
View Source
var ErrLimitReached = errors.New("limit reached")
Functions ¶
func ExpandIndexFunc ¶
Returns index where truth was found.
func ExpandLastIndexFunc ¶
Returns last index before truth was found.
func IsWordRune ¶
func LastIndexFunc ¶
func ReaderIter ¶
Iterate over n+1 runes, with the last rune being eofRune(-1).
func SetString ¶
func SetString(rw ReadWriter, s string) error
func ToLowerAsciiCopy ¶
Lower case at byte level without expanding in size the resulting byte slice.
func WordIsolated ¶
Types ¶
type BytesReadWriter ¶
type BytesReadWriter struct {
// contains filtered or unexported fields
}
func NewBytesReadWriter ¶
func NewBytesReadWriter(b []byte) *BytesReadWriter
func (*BytesReadWriter) Delete ¶
func (rw *BytesReadWriter) Delete(i, n int) error
func (*BytesReadWriter) Max ¶
func (rw *BytesReadWriter) Max() int
func (*BytesReadWriter) Min ¶
func (rw *BytesReadWriter) Min() int
func (*BytesReadWriter) ReadLastRuneAt ¶
func (rw *BytesReadWriter) ReadLastRuneAt(i int) (ru rune, size int, err error)
func (*BytesReadWriter) ReadNCopyAt ¶
func (rw *BytesReadWriter) ReadNCopyAt(i, n int) ([]byte, error)
func (*BytesReadWriter) ReadNSliceAt ¶
func (rw *BytesReadWriter) ReadNSliceAt(i, n int) ([]byte, error)
func (*BytesReadWriter) ReadRuneAt ¶
func (rw *BytesReadWriter) ReadRuneAt(i int) (ru rune, size int, err error)
type LimitedReader ¶
type LimitedReader struct { Reader // contains filtered or unexported fields }
Limits reading while keeping the original offsets.
func NewLimitedReader ¶
func NewLimitedReader(r Reader, min, max, pad int) *LimitedReader
func NewLimitedReaderLen ¶
func NewLimitedReaderLen(r Reader, offset, n int) *LimitedReader
func (*LimitedReader) Max ¶
func (r *LimitedReader) Max() int
func (*LimitedReader) Min ¶
func (r *LimitedReader) Min() int
func (*LimitedReader) ReadLastRuneAt ¶
func (r *LimitedReader) ReadLastRuneAt(i int) (ru rune, size int, err error)
func (*LimitedReader) ReadNCopyAt ¶
func (r *LimitedReader) ReadNCopyAt(i, n int) ([]byte, error)
func (*LimitedReader) ReadNSliceAt ¶
func (r *LimitedReader) ReadNSliceAt(i, n int) ([]byte, error)
func (*LimitedReader) ReadRuneAt ¶
func (r *LimitedReader) ReadRuneAt(i int) (ru rune, size int, err error)
type ReadWriter ¶
type Reader ¶
type Reader interface { ReadRuneAt(i int) (ru rune, size int, err error) ReadLastRuneAt(i int) (ru rune, size int, err error) // there must be at least N bytes available or there will be an error ReadNCopyAt(i, n int) ([]byte, error) ReadNSliceAt(i, n int) ([]byte, error) // []byte might not be a copy Min() int Max() int // not inclusive }
func NewStringReader ¶
type UndoRedo ¶
type UndoRedo struct { Type WriterOp Index int B []byte // insert/delete B2 []byte // overwrite insert }
func DeleteUndoRedo ¶
func DeleteUndoRedo(rw ReadWriter, i, n int) (*UndoRedo, error)
func OverwriteUndoRedo ¶
func OverwriteUndoRedo(rw ReadWriter, i, length int, p []byte) (*UndoRedo, error)
Click to show internal directories.
Click to hide internal directories.