Documentation ¶
Overview ¶
Package rope implements Ropes, a copy-on-write, string-like data structure that is optimized for efficient modification of large sequences of bytes at the cost of more expensive random-access.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IndexFunc ¶
IndexFunc returns the byte index of the first rune in the rope for which a function returns true. If the function never returns true, IndexFunc returns -1.
Types ¶
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader implements io.Reader, io.ByteReader, and io.RuneReader, reading from the contents of a Rope.
func (*Reader) Read ¶
Read reads into p and returns the number of bytes read. If there is nothing left to read, Read returns 0 and io.EOF. Read does not return errors other than io.EOF.
func (*Reader) ReadByte ¶
ReadByte returns the next byte. If there are no more bytes to read, ReadByte returns 0 and io.EOF. ReadByte does not return errors other than io.EOF.
type ReverseReader ¶
type ReverseReader struct {
// contains filtered or unexported fields
}
ReverseReader implements io.Reader, io.ByteReader, and io.RuneReader, reading from the contents of a Rope in reverse.
func NewReverseReader ¶
func NewReverseReader(rope Rope) *ReverseReader
NewReverseReader returns a new *ReverseReader that reads the contents of the Rope in reverse.
func (*ReverseReader) Read ¶
func (r *ReverseReader) Read(p []byte) (int, error)
Read reads into p and returns the number of bytes read. If there is nothing left to read, Read returns 0 and io.EOF. Read does not return errors other than io.EOF.
func (*ReverseReader) ReadByte ¶
func (r *ReverseReader) ReadByte() (byte, error)
ReadByte returns the next byte. If there are no more bytes to read, ReadByte returns 0 and io.EOF. ReadByte does not return errors other than io.EOF.
func (*ReverseReader) ReadRune ¶
func (r *ReverseReader) ReadRune() (rune, int, error)
ReadRune returns the next rune and it's byte-width. If the next bytes are not valid UTF8, ReadRune returns utf8.RuneError, 1. If there are no more bytes to read, ReadRune returns 0 and io.EOF. ReadRune does not return errors other than io.EOF.
type Rope ¶
Rope is a copy-on-write string, optimized for concatenation and splitting.
func Delete ¶
Delete deletes n bytes from r beginning at index start. Delete panics if start < 0, n < 0, or start+n > r.Len().
func ReadFrom ¶
ReadFrom returns a new Rope containing all of the bytes read from a reader until io.EOF. On error, the returned Rope contains any bytes read from the Reader before the error. If no bytes were read, the Rope is empty.