runes

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: Apache-2.0, BSD-3-Clause Imports: 3 Imported by: 0

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

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

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

type SizeLimitError struct {
	Size  int
	Limit int
}

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

func (*SizeLimitError) Error

func (e *SizeLimitError) Error() string

Jump to

Keyboard shortcuts

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