runes

package
v0.29.1 Latest Latest
Warning

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

Go to latest
Published: Jul 3, 2026 License: Apache-2.0, BSD-3-Clause Imports: 3 Imported by: 2

Documentation

Overview

Package runes provides interfaces and utilities for working with runes.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Buffer

type Buffer interface {
	Get(i int) rune
	Slice(i, j int) string
	Len() int
}

Buffer is an interface for accessing a contiguous array of code points.

func NewBuffer

func NewBuffer(data string) Buffer

NewBuffer returns an efficient implementation of Buffer for the given text based on the ranges of the encoded code points contained within.

func NewBufferAndLineOffsets added in v0.21.0

func NewBufferAndLineOffsets(data string) (Buffer, []int32)

NewBufferAndLineOffsets returns an efficient implementation of Buffer for the given text based on the ranges of the encoded code points contained within, as well as returning the line offsets.

func NewBufferAndLineOffsetsWithLimit added in v0.29.0

func NewBufferAndLineOffsetsWithLimit(data string, limit int) (Buffer, []int32, error)

NewBufferAndLineOffsetsWithLimit returns an efficient implementation of Buffer for the given text and enforces a code point limit while constructing the buffer.

type SizeLimitError added in v0.29.0

type SizeLimitError struct {
	Size  int
	Limit int
}

SizeLimitError indicates that the input exceeded the configured code point limit.

func (*SizeLimitError) Error added in v0.29.0

func (e *SizeLimitError) Error() string

Jump to

Keyboard shortcuts

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