capbuilder

package
v0.0.0-...-4e18fe8 Latest Latest
Warning

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

Go to latest
Published: Dec 9, 2021 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package capbuilder provides the CappedBuilder.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CappedBuilder

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

func New

func New(totalCap, chunkCap int) *CappedBuilder

New creates a new CappedBuilder with the passed total capacity and the passed initial chunk capacity.

func (*CappedBuilder) ChunkLen

func (b *CappedBuilder) ChunkLen() int

ChunkLen returns the length of the current chunk.

func (*CappedBuilder) Rem

func (b *CappedBuilder) Rem() int

Rem returns the total amount of remaining characters.

func (*CappedBuilder) Reset

func (b *CappedBuilder) Reset(chunkCap int)

Reset resets the current chunk and creates a new one with the passed capacity.

func (*CappedBuilder) String

func (b *CappedBuilder) String() string

String returns the string value of the current chunk.

func (*CappedBuilder) Use

func (b *CappedBuilder) Use(n int)

Use manually uses up n characters of the total chunk, without writing anything to the current chunk, or draining it.

func (*CappedBuilder) WriteRune

func (b *CappedBuilder) WriteRune(r rune)

WriteRune writes the passed rune to the CappedBuilder's current chunk, if there is space.

func (*CappedBuilder) WriteString

func (b *CappedBuilder) WriteString(s string)

WriteString writes th passed string to the CappedBuilder's current chunk. If there is insufficient space for the entire string, only part of it will be written to the chunk. If there is no space, the string will be discarded.

Jump to

Keyboard shortcuts

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